dep: support 'hashable 1.4'

This commit is contained in:
Anton-Latukha 2022-01-06 11:53:54 +02:00
parent 64ba3c78c6
commit 45383f8215
No known key found for this signature in database
GPG Key ID: 3D84C07E91802E41
4 changed files with 27 additions and 15 deletions

View File

@ -42,7 +42,7 @@ jobs:
- name: "Repository update"
run: cabal v2-update
# NOTE: Freeze is for the caching
# Freeze is for the caching
- name: "Configuration freeze"
run: cabal v2-freeze $cabalConfig
@ -55,12 +55,15 @@ jobs:
key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-
# 2022-01-06: NOTE: remove `--allow-newer hashable` after `relude` updates to `hashable` 1.4
- name: "Build"
run: cabal v2-build $cabalConfig
run: cabal v2-build $cabalConfig --allow-newer hashable
# 2022-01-06: NOTE: remove `--allow-newer hashable` after `relude` updates to `hashable` 1.4
- name: "Tests"
run: cabal v2-test $cabalConfig
# 2022-01-06: NOTE: remove `--allow-newer hashable` after `relude` updates to `hashable` 1.4
- name: "Haddock"
if: ${{ matrix.ghc == '9.0' }}
run: cabal v2-haddock $cabalConfig

View File

@ -422,7 +422,7 @@ library
, filepath >= 1.4.2 && < 1.5
, free >= 5.1 && < 5.2
, gitrev >= 1.1.0 && < 1.4
, hashable >= 1.2.5 && < 1.4
, hashable >= 1.2.5 && < 1.5
, hashing >= 0.1.0 && < 0.2
, hnix-store-core >= 0.5.0 && < 0.6
, hnix-store-remote >= 0.5.0 && < 0.6

View File

@ -176,7 +176,7 @@ data Params r
( Eq, Ord, Generic, Generic1
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, ToJSON1, FromJSON, FromJSON1
, Functor, Foldable, Traversable
, Show, Hashable, Hashable1
, Show, Hashable
)
instance IsString (Params r) where
@ -187,6 +187,8 @@ $(deriveRead1 ''Params)
$(deriveEq1 ''Params)
$(deriveOrd1 ''Params)
deriving instance Hashable1 Params
-- *** lens traversals
$(makeTraversals ''Params)
@ -212,14 +214,9 @@ data Antiquoted (v :: Type) (r :: Type)
, Typeable, Data, NFData, NFData1, Serialise, Binary
, ToJSON, ToJSON1, FromJSON, FromJSON1
, Functor, Foldable, Traversable
, Show, Read, Hashable, Hashable1
, Show, Read, Hashable
)
instance Hashable2 Antiquoted where
liftHashWithSalt2 ha _ salt (Plain a) = ha (salt `hashWithSalt` (0 :: Int)) a
liftHashWithSalt2 _ _ salt EscapedNewline = salt `hashWithSalt` (1 :: Int)
liftHashWithSalt2 _ hb salt (Antiquoted b) = hb (salt `hashWithSalt` (2 :: Int)) b
$(deriveShow1 ''Antiquoted)
$(deriveShow2 ''Antiquoted)
$(deriveRead1 ''Antiquoted)
@ -230,6 +227,12 @@ $(deriveOrd1 ''Antiquoted)
$(deriveOrd2 ''Antiquoted)
$(deriveJSON2 defaultOptions ''Antiquoted)
instance Hashable2 Antiquoted where
liftHashWithSalt2 ha _ salt (Plain a) = ha (salt `hashWithSalt` (0 :: Int)) a
liftHashWithSalt2 _ _ salt EscapedNewline = salt `hashWithSalt` (1 :: Int)
liftHashWithSalt2 _ hb salt (Antiquoted b) = hb (salt `hashWithSalt` (2 :: Int)) b
deriving instance (Hashable v) => Hashable1 (Antiquoted (v :: Type))
-- *** lens traversals
@ -263,7 +266,7 @@ data NString r
( Eq, Ord, Generic, Generic1
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, ToJSON1, FromJSON, FromJSON1
, Functor, Foldable, Traversable
, Show, Read, Hashable, Hashable1
, Show, Read, Hashable
)
-- | For the the 'IsString' instance, we use a plain doublequoted string.
@ -276,6 +279,8 @@ $(deriveRead1 ''NString)
$(deriveEq1 ''NString)
$(deriveOrd1 ''NString)
deriving instance Hashable1 NString
-- *** lens traversals
$(makeTraversals ''NString)
@ -423,7 +428,7 @@ data Binding r
( Eq, Ord, Generic, Generic1
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, FromJSON
, Functor, Foldable, Traversable
, Show, Hashable, Hashable1
, Show, Hashable
)
$(deriveShow1 ''Binding)
@ -431,6 +436,8 @@ $(deriveEq1 ''Binding)
$(deriveOrd1 ''Binding)
--x $(deriveJSON1 defaultOptions ''Binding)
deriving instance Hashable1 Binding
-- *** lens traversals
$(makeTraversals ''Binding)
@ -596,7 +603,7 @@ data NExprF r
( Eq, Ord, Generic, Generic1
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, FromJSON
, Functor, Foldable, Traversable
, Show, Hashable, Hashable1
, Show, Hashable
)
@ -605,6 +612,8 @@ $(deriveEq1 ''NExprF)
$(deriveOrd1 ''NExprF)
--x $(deriveJSON1 defaultOptions ''NExprF)
deriving instance Hashable1 NExprF
-- ** lens traversals
$(makeTraversals ''NExprF)

View File

@ -111,8 +111,6 @@ annUnitToAnn (AnnUnit ann a) = Ann ann a
-- ** Instances
instance Hashable ann => Hashable1 (AnnUnit ann)
instance NFData ann => NFData1 (AnnUnit ann)
instance (Binary ann, Binary a) => Binary (AnnUnit ann a)
@ -128,6 +126,8 @@ $(deriveShow2 ''AnnUnit)
$(deriveJSON1 defaultOptions ''AnnUnit)
$(deriveJSON2 defaultOptions ''AnnUnit)
instance Hashable ann => Hashable1 (AnnUnit ann)
instance (Serialise ann, Serialise a) => Serialise (AnnUnit ann a)
-- ** @NExprLoc{,F}@ - annotated Nix expression