[#420] Add support for GHC 9.4 (#433)

* [#420] Add support for GHC 9.4

Resolves #420

* Try to fix doctest

* Drop support of GHC-8.2

* Fix doctest

* Remove Extra.Map Eq constraint warning
This commit is contained in:
Veronika Romashkina 2023-03-01 15:45:30 +00:00 committed by GitHub
parent 31ebe74a10
commit 1dc4b82150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 97 additions and 59 deletions

2
.github/CODEOWNERS vendored
View File

@ -1 +1 @@
* @chshersh @vrom911
* @vrom911

View File

@ -16,16 +16,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["3.6"]
cabal: ["3.8"]
ghc:
- "8.2.2"
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.7"
- "9.0.2"
- "9.2.2"
- "9.2.7"
- "9.4.4"
exclude:
- os: macOS-latest
ghc: 9.2.7
- os: macOS-latest
ghc: 9.0.2
- os: macOS-latest
@ -36,9 +38,9 @@ jobs:
ghc: 8.6.5
- os: macOS-latest
ghc: 8.4.4
- os: macOS-latest
ghc: 8.2.2
- os: windows-latest
ghc: 9.2.7
- os: windows-latest
ghc: 9.0.2
- os: windows-latest
@ -49,8 +51,6 @@ jobs:
ghc: 8.6.5
- os: windows-latest
ghc: 8.4.4
- os: windows-latest
ghc: 8.2.2
steps:
- uses: actions/checkout@v3
@ -97,8 +97,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
stack: ["2.7"]
ghc: ["8.10.7"]
stack: ["2.9"]
ghc: ["9.2.6"]
steps:
- uses: actions/checkout@v3

View File

@ -3,6 +3,21 @@
`relude` uses [PVP Versioning][1].
The changelog is available [on GitHub][2].
## Unreleased
* [#420](https://github.com/kowainik/relude/issues/420):
Support GHC-9.4.
* Reexport `type (~)` from `Data.Type.Equality` for GHC-9.4.
* Add `-Wredundant-strictness-flags` and `-Wforall-identifier` warnings for
GHC-9.4.
* [#430](https://github.com/kowainik/relude/issues/430):
Upgrade dependencies:
- `ghc-prim-0.9`
- `mtl-2.3`
- `hedgehog-1.2`
- `doctest-0.21`
* Drop support of GHC-8.2.
## 1.1.0.0 — Jun 9, 2022
* [#388](https://github.com/kowainik/relude/issues/388):

View File

@ -723,7 +723,7 @@ alternative preludes. It's also relatively small, but:
_O(n)_ time and you can accidentally use `elem` from `Foldable` but with
`relude` you can't).
4. Protolude supports older GHC versions (from GHC 7.6.1) while `relude` only
supports from GHC 8.2.2. So if you aim ancient GHC versions, `protolude`
supports from GHC 8.4. So if you aim ancient GHC versions, `protolude`
might be a better choice. But because of that it contains a lot of CPP, code
is scary in some places as a consequence and it is more difficult to add,
remove or change things there.

View File

@ -91,13 +91,13 @@ stability: stable
build-type: Simple
extra-doc-files: CHANGELOG.md
README.md
tested-with: GHC == 8.2.2
GHC == 8.4.4
tested-with: GHC == 8.4.4
GHC == 8.6.5
GHC == 8.8.4
GHC == 8.10.7
GHC == 9.0.2
GHC == 9.2.2
GHC == 9.2.7
GHC == 9.4.4
source-repository head
@ -105,8 +105,6 @@ source-repository head
location: git@github.com:kowainik/relude.git
common common-options
build-depends: base >= 4.10 && < 4.17
ghc-options: -Wall
-Wcompat
-Widentities
@ -127,6 +125,9 @@ common common-options
if impl(ghc >= 9.2)
ghc-options: -Wredundant-bang-patterns
-Woperator-whitespace
if impl(ghc >= 9.4)
ghc-options: -Wredundant-strictness-flags
-Wforall-identifier
default-language: Haskell2010
@ -227,12 +228,13 @@ library
, Data.ByteString.Short
build-depends: bytestring >= 0.10 && < 0.12
build-depends: base >= 4.11 && < 4.18
, bytestring >= 0.10 && < 0.12
, containers >= 0.5.10 && < 0.7
, deepseq ^>= 1.4
, ghc-prim >= 0.4.0.0 && < 0.9
, ghc-prim >= 0.5.0.0 && < 0.10
, hashable >= 1.2 && < 1.5
, mtl ^>= 2.2
, mtl >= 2.2 && < 2.4
, stm >= 2.4 && < 2.6
, text >= 1.2 && < 2.1
, transformers >= 0.5 && < 0.7
@ -248,11 +250,12 @@ test-suite relude-test
other-modules: Test.Relude.Gen
Test.Relude.Container.One
Test.Relude.Property
build-depends: relude
build-depends: base
, relude
, bytestring
, containers
, text
, hedgehog >= 1.0 && < 1.2
, hedgehog >= 1.0 && < 1.3
ghc-options: -threaded
@ -263,7 +266,7 @@ test-suite relude-doctest
main-is: Doctest.hs
build-depends: relude
, doctest ^>= 0.20
, doctest >= 0.20 && < 0.22
, Glob
ghc-options: -threaded
@ -274,7 +277,8 @@ benchmark relude-benchmark
hs-source-dirs: benchmark
main-is: Main.hs
build-depends: relude
build-depends: base
, relude
, tasty-bench
, unordered-containers

View File

@ -1,4 +1,6 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE Trustworthy #-}
{- |
Module : Relude.Base
@ -29,6 +31,9 @@ module Relude.Base
, module Data.Coerce
, module Data.Kind
, module Data.Proxy
#if __GLASGOW_HASKELL__ >= 904
, module Data.Type.Equality
#endif
, module Data.Typeable
, module Data.Void
@ -51,13 +56,16 @@ import Data.Char (Char, chr)
import System.IO (FilePath, IO, IOMode (..))
-- Base typeclasses
import Data.Eq (Eq, (==), (/=))
import Data.Eq (Eq, (/=), (==))
import Data.Ord (Down (..), Ord (..), Ordering (..), comparing)
-- Types for type-level computation
import Data.Coerce (Coercible, coerce)
import Data.Kind (Constraint, Type)
import Data.Proxy (Proxy (..))
#if __GLASGOW_HASKELL__ >= 904
import Data.Type.Equality (type (~))
#endif
import Data.Typeable (Typeable)
import Data.Void (Void, absurd, vacuous)

View File

@ -3,6 +3,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
@ -12,10 +13,6 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
#if __GLASGOW_HASKELL__ > 802
{-# LANGUAGE DerivingStrategies #-}
#endif
{- |
Module : Relude.Debug
Copyright : (c) 2016 Stephen Diehl
@ -89,6 +86,9 @@ module Relude.Debug
) where
import Data.Data (Data)
#if __GLASGOW_HASKELL__ >= 904
import Data.Type.Equality (type (~))
#endif
import GHC.Exts (RuntimeRep, TYPE)
import GHC.TypeLits (ErrorMessage (..), TypeError)
@ -255,7 +255,7 @@ error handling mechanism.
>>> error "oops"
*** Exception: oops
CallStack (from HasCallStack):
error, called at src\\Relude\\Debug.hs:289:11 in ...
error, called at src\Relude\Debug.hs:289:11 in ...
...
#else
>>> error "oops"
@ -309,11 +309,7 @@ type family CheckIsText (t :: Type) :: Constraint where
-- | Similar to 'undefined' but data type.
data Undefined = Undefined
#if __GLASGOW_HASKELL__ > 802
deriving stock (Eq, Ord, Show, Read, Enum, Bounded, Data, Typeable, Generic)
#else
deriving (Eq, Ord, Show, Read, Enum, Bounded, Data, Typeable, Generic)
#endif
{-# WARNING Undefined "'Undefined' type remains in code" #-}
-- | 'Prelude.undefined' that leaves warning in code on every usage.

View File

@ -1,13 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE ViewPatterns #-}
#if __GLASGOW_HASKELL__ > 802
{-# LANGUAGE DerivingStrategies #-}
#endif
{- |
Module : Relude.Exception
Copyright : (c) 2016 Stephen Diehl
@ -48,11 +44,7 @@ import qualified Control.Exception as E (displayException, throw, toException)
not meant to be ever executed, but happens to be executed anyway.
-}
data Bug = Bug SomeException CallStack
#if __GLASGOW_HASKELL__ > 802
deriving stock (Show)
#else
deriving (Show)
#endif
instance Exception Bug where
displayException (Bug e cStack) =

View File

@ -1,5 +1,6 @@
{-# LANGUAGE Safe #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{- |
Module : Relude.Extra.Group

View File

@ -1,5 +1,7 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{- |
Module : Relude.Extra.Map
@ -26,9 +28,17 @@ module Relude.Extra.Map
, elems
) where
#if __GLASGOW_HASKELL__ >= 904
import Data.Type.Equality (type (~))
#endif
import GHC.Exts (IsList (Item, toList))
#if MIN_VERSION_hashable(1,4,0)
import Relude.Base (Ord, Type)
#else
import Relude.Base (Eq, Ord, Type)
#endif
import Relude.Bool (Bool, guard, not)
import Relude.Container.Reexport (HashMap, HashSet, Hashable, IntMap, IntSet, Map, Set, fst, snd)
import Relude.Function ((.))
@ -80,7 +90,11 @@ instance Ord k => StaticMap (Map k v) where
@since 0.1.0
-}
#if MIN_VERSION_hashable(1,4,0)
instance (Hashable k) => StaticMap (HashMap k v) where
#else
instance (Eq k, Hashable k) => StaticMap (HashMap k v) where
#endif
type Key (HashMap k v) = k
type Val (HashMap k v) = v
@ -125,7 +139,11 @@ instance Ord a => StaticMap (Set a) where
@since 0.1.0
-}
#if MIN_VERSION_hashable(1,4,0)
instance (Hashable a) => StaticMap (HashSet a) where
#else
instance (Eq a, Hashable a) => StaticMap (HashSet a) where
#endif
type Key (HashSet a) = a
type Val (HashSet a) = a
@ -237,7 +255,11 @@ instance Ord k => DynamicMap (Map k v) where
@since 0.1.0
-}
#if MIN_VERSION_hashable(1,4,0)
instance (Hashable k) => DynamicMap (HashMap k v) where
#else
instance (Eq k, Hashable k) => DynamicMap (HashMap k v) where
#endif
insert = HM.insert
{-# INLINE insert #-}
insertWith = HM.insertWith

View File

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}
{- |
@ -19,9 +18,7 @@ module Relude.Extra.Newtype
, wrap
, under
, under2
#if ( __GLASGOW_HASKELL__ != 802 )
, underF2
#endif
, (#.)
) where
@ -89,7 +86,6 @@ under2 :: forall n a . Coercible a n => (n -> n -> n) -> (a -> a -> a)
under2 = coerce
{-# INLINE under2 #-}
#if ( __GLASGOW_HASKELL__ != 802 )
{- | Version of 'under2' that works on @newtype@s parametrized by their
representation. Provided for convenience.
@ -103,7 +99,6 @@ representation. Provided for convenience.
underF2 :: forall n a . Coercible a (n a) => (n a -> n a -> n a) -> (a -> a -> a)
underF2 = coerce
{-# INLINE underF2 #-}
#endif
{- | Coercible composition. This function allows to write more efficient
implementations of function compositions over @newtypes@.

View File

@ -36,7 +36,7 @@ import Type.Reflection (typeRep)
-- $setup
-- >>> :set -XAllowAmbiguousTypes -XDataKinds -XExplicitNamespaces -XPolyKinds -XTypeFamilies -XTypeOperators -XUndecidableInstances
-- >>> :set -XAllowAmbiguousTypes -XDataKinds -XExplicitNamespaces -XPolyKinds -XTypeFamilies -XTypeOperators -XUndecidableInstances
{- | Gets a string representation of a type.

View File

@ -27,8 +27,8 @@ import Data.Foldable (Foldable (fold, foldMap, foldl', foldr, length, null, toLi
#if MIN_VERSION_base(4,13,0)
import Data.Foldable (foldMap')
#endif
import Data.Traversable (Traversable (..), forM, mapAccumL, mapAccumR)
import Data.Bifoldable (Bifoldable (..), biList, biall, biand, biany, biasum, bielem, bifind,
bifoldl', bifoldlM, bifoldr', bifoldrM, bifor_, bilength, binull, bior,
bisequence_, bitraverse_)
import Data.Bitraversable (Bitraversable (..), bifoldMapDefault, bifor, bimapDefault, bisequence)
import Data.Traversable (Traversable (..), forM, mapAccumL, mapAccumR)

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE Safe #-}
@ -88,6 +89,9 @@ module Relude.List.NonEmpty
) where
import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
#if __GLASGOW_HASKELL__ >= 904
import Data.Type.Equality (type (~))
#endif
import GHC.TypeLits (ErrorMessage (..), Symbol, TypeError)
import Relude.Applicative (Applicative, pass)

View File

@ -55,8 +55,8 @@ module Relude.Nub
#if !MIN_VERSION_hashable(1,4,0)
import Data.Eq (Eq)
#endif
import Data.HashSet as HashSet
import Data.Hashable (Hashable)
import Data.HashSet as HashSet
import Data.Ord (Ord)
import Prelude (Int, (.))

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
@ -50,6 +51,9 @@ import Data.Text (Text)
import Data.Text.Encoding (decodeUtf8', decodeUtf8With)
import Data.Text.Encoding.Error (OnDecodeError, OnError, UnicodeException, lenientDecode,
strictDecode)
#if __GLASGOW_HASKELL__ >= 904
import Data.Type.Equality (type (~))
#endif
import GHC.TypeLits (ErrorMessage (..), Symbol, TypeError)
import Text.Read (Read, readMaybe, reads)

View File

@ -1,4 +1 @@
resolver: lts-18.28
extra-deps:
- doctest-0.20.0@sha256:fd56edde124a92d42c42c74333f0ae74532329d15a6c63d578cbb51f4e7cfd34,7121
resolver: lts-20.12