Skip to content

Commit 9dc602d

Browse files
committed
treewide: sequnce(->A)
1 parent d1a7f75 commit 9dc602d

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

src/Nix/Builtins.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ langVersionNix = toValue (5 :: Int)
17701770
-- ** @builtinsList@
17711771

17721772
builtinsList :: forall e t f m . MonadNix e t f m => m [Builtin (NValue t f m)]
1773-
builtinsList = sequence
1773+
builtinsList = sequenceA
17741774
[ add0 Normal "nixVersion" nixVersionNix
17751775
, add0 Normal "langVersion" langVersionNix
17761776
, add TopLevel "abort" throwNix -- for now

src/Nix/Convert.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ instance ( Convertible e t f m
277277
=> FromValue [a] m (Deeper (NValue' t f m (NValue t f m))) where
278278
fromValueMay =
279279
\case
280-
Deeper (NVList' l) -> sequence <$> traverse fromValueMay l
280+
Deeper (NVList' l) -> sequenceA <$> traverse fromValueMay l
281281
_ -> stub
282282

283283

@@ -301,7 +301,7 @@ instance ( Convertible e t f m
301301

302302
fromValueMay =
303303
\case
304-
Deeper (NVSet' _ s) -> sequence <$> traverse fromValueMay s
304+
Deeper (NVSet' _ s) -> sequenceA <$> traverse fromValueMay s
305305
_ -> stub
306306

307307
fromValue = fromMayToDeeperValue TSet
@@ -326,7 +326,7 @@ instance ( Convertible e t f m
326326

327327
fromValueMay =
328328
\case
329-
Deeper (NVSet' p s) -> fmap (, p) . sequence <$> traverse fromValueMay s
329+
Deeper (NVSet' p s) -> fmap (, p) . sequenceA <$> traverse fromValueMay s
330330
_ -> stub
331331

332332
fromValue = fromMayToDeeperValue TSet

src/Nix/Effects/Derivation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ defaultDerivationStrict val = do
272272
(Map.keys $ outputs drv)
273273
)
274274
}
275-
outputs' <- sequence $ Map.mapWithKey (\o _ -> makeOutputPath o hash drvName) $ outputs drv
275+
outputs' <- sequenceA $ Map.mapWithKey (\o _ -> makeOutputPath o hash drvName) $ outputs drv
276276
pure $ drv
277277
{ inputs
278278
, outputs = outputs'

src/Nix/Eval.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ attrSetAlter (k : ks) pos m p val =
244244
(\(st', _) ->
245245
(M.insert
246246
k
247-
(toValue @(AttrSet v, PositionSet) =<< (, mempty) <$> sequence st')
247+
(toValue @(AttrSet v, PositionSet) =<< (, mempty) <$> sequenceA st')
248248
m
249249
, M.insert (coerce k) pos p
250250
)
@@ -465,7 +465,7 @@ assembleString
465465
-> m (Maybe NixString)
466466
assembleString = fromParts . stringParts
467467
where
468-
fromParts xs = (mconcat <$>) . sequence <$> traverse go xs
468+
fromParts xs = (mconcat <$>) . sequenceA <$> traverse go xs
469469
go =
470470
runAntiquoted
471471
"\n"

src/Nix/Exec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ addTracing k v = do
500500
depth <- ask
501501
guard $ depth < 2000
502502
local succ $ do
503-
v'@(AnnF span x) <- sequence v
503+
v'@(AnnF span x) <- sequenceA v
504504
pure $ do
505505
opts :: Options <- asks $ view hasLens
506506
let

src/Nix/Reduce.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ reduce (NBinaryAnnF bann op larg rarg) =
204204
-- 3. The selected AttrPath exists in the set.
205205
reduce base@(NSelectAnnF _ _ _ attrs)
206206
| sAttrPath $ NE.toList attrs = do
207-
(NSelectAnnF _ _ aset attrs) <- sequence base
207+
(NSelectAnnF _ _ aset attrs) <- sequenceA base
208208
inspectSet (unFix aset) attrs
209209
| otherwise = sId
210210
where
@@ -242,14 +242,14 @@ reduce e@(NSetAnnF ann NonRecursive binds) =
242242
binds
243243

244244
bool
245-
(clearScopes @NExprLoc $ NSetAnn ann mempty <$> traverse sequence binds)
246245
(reduceLayer e)
246+
(clearScopes @NExprLoc $ NSetAnn ann mempty <$> traverse sequenceA binds)
247247
usesInherit
248248

249249
-- Encountering a 'rec set' construction eliminates any hope of inlining
250250
-- definitions.
251251
reduce (NSetAnnF ann Recursive binds) =
252-
clearScopes @NExprLoc $ NSetAnn ann Recursive <$> traverse sequence binds
252+
clearScopes @NExprLoc $ NSetAnn ann Recursive <$> traverse sequenceA binds
253253

254254
-- Encountering a 'with' construction eliminates any hope of inlining
255255
-- definitions.
@@ -260,7 +260,7 @@ reduce (NWithAnnF ann scope body) =
260260
-- constants and strings to the body scope.
261261
reduce (NLetAnnF ann binds body) =
262262
do
263-
binds' <- traverse sequence binds
263+
binds' <- traverse sequenceA binds
264264
body' <-
265265
(`pushScope` body) . coerce . HM.fromList . catMaybes =<<
266266
traverse
@@ -281,7 +281,7 @@ reduce (NLetAnnF ann binds body) =
281281
binds
282282

283283
-- let names = gatherNames body'
284-
-- binds' <- traverse sequence binds <&> \b -> flip filter b $ \case
284+
-- binds' <- traverse sequenceA binds <&> \b -> flip filter b $ \case
285285
-- NamedVar (StaticKey name _ :| []) _ ->
286286
-- name `S.member` names
287287
-- _ -> True
@@ -307,11 +307,11 @@ reduce e@(NIfAnnF _ b t f) =
307307
reduce e@(NAssertAnnF _ b body) =
308308
(\case
309309
NConstantAnn _ (NBool b') | b' -> body
310-
_ -> Fix <$> sequence e
310+
_ -> reduceLayer e
311311
) =<< b
312312

313313
reduce (NAbsAnnF ann params body) = do
314-
params' <- sequence params
314+
params' <- sequenceA params
315315
-- Make sure that variable definitions in scope do not override function
316316
-- arguments.
317317
let
@@ -369,7 +369,7 @@ pruneTree opts =
369369
NSet recur binds -> pure $ NSet recur $
370370
bool
371371
(fromMaybe annNNull <<$>>)
372-
(mapMaybe sequence)
372+
(mapMaybe sequenceA)
373373
(reduceSets opts) -- Reduce set members that aren't used; breaks if hasAttr is used
374374
binds
375375

@@ -410,7 +410,7 @@ pruneTree opts =
410410
NIf _ Nothing (Just (Ann _ f)) -> pure f
411411
NIf _ (Just (Ann _ t)) Nothing -> pure t
412412

413-
x -> sequence x
413+
x -> sequenceA x
414414

415415
pruneString :: NString (Maybe NExprLoc) -> NString NExprLoc
416416
pruneString (DoubleQuoted xs) = DoubleQuoted $ mapMaybe pruneAntiquotedText xs

src/Nix/Render/Frame.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ renderEvalFrame level f =
123123
"While calling builtins." <> pretty name
124124

125125
SynHole synfo ->
126-
sequence $
126+
sequenceA $
127127
let e@(Ann ann _) = _synHoleInfo_expr synfo in
128128

129129
[ renderLocation ann =<<

src/Nix/XML.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ toXML = runWithStringContext . fmap pp . iterNValueByDiscardWith cyc phi
4747
mkEVal "string" . toString <$> extractNixString str
4848
NVList' l ->
4949
do
50-
els <- sequence l
50+
els <- sequenceA l
5151
pure $
5252
mkE
5353
"list"
5454
(Elem <$> els)
5555

5656
NVSet' _ s ->
5757
do
58-
kvs <- sequence s
58+
kvs <- sequenceA s
5959
pure $
6060
mkE
6161
"attrs"

0 commit comments

Comments
 (0)