Skip to content

Commit 084766c

Browse files
Merge #1022: dep: support 'hashable 1.4'
At the time, upstream still needed to kowainik/relude#394
2 parents 64ba3c7 + 6ad7f3e commit 084766c

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

.github/workflows/Cabal-Linux.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ jobs:
1717
name: "GHC"
1818
runs-on: ubuntu-latest
1919
strategy:
20+
fail-fast: false
2021
matrix:
21-
ghc: [ "9.0", "8.8" ]
22+
ghc:
23+
[ "8.8"
24+
, "9.0"
25+
]
2226
steps:
2327

2428
- name: "Git checkout"
@@ -42,9 +46,9 @@ jobs:
4246
- name: "Repository update"
4347
run: cabal v2-update
4448

45-
# NOTE: Freeze is for the caching
49+
# Freeze is for the caching
4650
- name: "Configuration freeze"
47-
run: cabal v2-freeze $cabalConfig
51+
run: cabal v2-freeze $cabalConfig --minimize-conflict-set
4852

4953
- name: "Configuring GitHub cache"
5054
uses: actions/cache@v2

hnix.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ library
422422
, filepath >= 1.4.2 && < 1.5
423423
, free >= 5.1 && < 5.2
424424
, gitrev >= 1.1.0 && < 1.4
425-
, hashable >= 1.2.5 && < 1.4
425+
, hashable >= 1.2.5 && < 1.5
426426
, hashing >= 0.1.0 && < 0.2
427427
, hnix-store-core >= 0.5.0 && < 0.6
428428
, hnix-store-remote >= 0.5.0 && < 0.6

src/Nix/Expr/Types.hs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ data Params r
176176
( Eq, Ord, Generic, Generic1
177177
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, ToJSON1, FromJSON, FromJSON1
178178
, Functor, Foldable, Traversable
179-
, Show, Hashable, Hashable1
179+
, Show, Hashable
180180
)
181181

182182
instance IsString (Params r) where
@@ -187,6 +187,8 @@ $(deriveRead1 ''Params)
187187
$(deriveEq1 ''Params)
188188
$(deriveOrd1 ''Params)
189189

190+
deriving instance Hashable1 Params
191+
190192
-- *** lens traversals
191193

192194
$(makeTraversals ''Params)
@@ -212,14 +214,9 @@ data Antiquoted (v :: Type) (r :: Type)
212214
, Typeable, Data, NFData, NFData1, Serialise, Binary
213215
, ToJSON, ToJSON1, FromJSON, FromJSON1
214216
, Functor, Foldable, Traversable
215-
, Show, Read, Hashable, Hashable1
217+
, Show, Read, Hashable
216218
)
217219

218-
instance Hashable2 Antiquoted where
219-
liftHashWithSalt2 ha _ salt (Plain a) = ha (salt `hashWithSalt` (0 :: Int)) a
220-
liftHashWithSalt2 _ _ salt EscapedNewline = salt `hashWithSalt` (1 :: Int)
221-
liftHashWithSalt2 _ hb salt (Antiquoted b) = hb (salt `hashWithSalt` (2 :: Int)) b
222-
223220
$(deriveShow1 ''Antiquoted)
224221
$(deriveShow2 ''Antiquoted)
225222
$(deriveRead1 ''Antiquoted)
@@ -230,6 +227,12 @@ $(deriveOrd1 ''Antiquoted)
230227
$(deriveOrd2 ''Antiquoted)
231228
$(deriveJSON2 defaultOptions ''Antiquoted)
232229

230+
instance Hashable2 Antiquoted where
231+
liftHashWithSalt2 ha _ salt (Plain a) = ha (salt `hashWithSalt` (0 :: Int)) a
232+
liftHashWithSalt2 _ _ salt EscapedNewline = salt `hashWithSalt` (1 :: Int)
233+
liftHashWithSalt2 _ hb salt (Antiquoted b) = hb (salt `hashWithSalt` (2 :: Int)) b
234+
235+
deriving instance (Hashable v) => Hashable1 (Antiquoted (v :: Type))
233236

234237
-- *** lens traversals
235238

@@ -263,7 +266,7 @@ data NString r
263266
( Eq, Ord, Generic, Generic1
264267
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, ToJSON1, FromJSON, FromJSON1
265268
, Functor, Foldable, Traversable
266-
, Show, Read, Hashable, Hashable1
269+
, Show, Read, Hashable
267270
)
268271

269272
-- | For the the 'IsString' instance, we use a plain doublequoted string.
@@ -276,6 +279,8 @@ $(deriveRead1 ''NString)
276279
$(deriveEq1 ''NString)
277280
$(deriveOrd1 ''NString)
278281

282+
deriving instance Hashable1 NString
283+
279284
-- *** lens traversals
280285

281286
$(makeTraversals ''NString)
@@ -423,14 +428,16 @@ data Binding r
423428
( Eq, Ord, Generic, Generic1
424429
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, FromJSON
425430
, Functor, Foldable, Traversable
426-
, Show, Hashable, Hashable1
431+
, Show, Hashable
427432
)
428433

429434
$(deriveShow1 ''Binding)
430435
$(deriveEq1 ''Binding)
431436
$(deriveOrd1 ''Binding)
432437
--x $(deriveJSON1 defaultOptions ''Binding)
433438

439+
deriving instance Hashable1 Binding
440+
434441
-- *** lens traversals
435442

436443
$(makeTraversals ''Binding)
@@ -596,7 +603,7 @@ data NExprF r
596603
( Eq, Ord, Generic, Generic1
597604
, Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, FromJSON
598605
, Functor, Foldable, Traversable
599-
, Show, Hashable, Hashable1
606+
, Show, Hashable
600607
)
601608

602609

@@ -605,6 +612,8 @@ $(deriveEq1 ''NExprF)
605612
$(deriveOrd1 ''NExprF)
606613
--x $(deriveJSON1 defaultOptions ''NExprF)
607614

615+
deriving instance Hashable1 NExprF
616+
608617
-- ** lens traversals
609618

610619
$(makeTraversals ''NExprF)

src/Nix/Expr/Types/Annotated.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ annUnitToAnn (AnnUnit ann a) = Ann ann a
111111

112112
-- ** Instances
113113

114-
instance Hashable ann => Hashable1 (AnnUnit ann)
115-
116114
instance NFData ann => NFData1 (AnnUnit ann)
117115

118116
instance (Binary ann, Binary a) => Binary (AnnUnit ann a)
@@ -128,6 +126,8 @@ $(deriveShow2 ''AnnUnit)
128126
$(deriveJSON1 defaultOptions ''AnnUnit)
129127
$(deriveJSON2 defaultOptions ''AnnUnit)
130128

129+
instance Hashable ann => Hashable1 (AnnUnit ann)
130+
131131
instance (Serialise ann, Serialise a) => Serialise (AnnUnit ann a)
132132

133133
-- ** @NExprLoc{,F}@ - annotated Nix expression

0 commit comments

Comments
 (0)