@@ -208,7 +208,7 @@ reduce base@(NSelectAnnF _ _ _ attrs)
208208 inspectSet (unFix aset) attrs
209209 | otherwise = sId
210210 where
211- sId = Fix <$> sequence base
211+ sId = reduceLayer base
212212 -- The selection AttrPath is composed of StaticKeys.
213213 sAttrPath (StaticKey _ : xs) = sAttrPath xs
214214 sAttrPath [] = True
@@ -242,8 +242,8 @@ reduce e@(NSetAnnF ann NonRecursive binds) =
242242 binds
243243
244244 bool
245- (Fix <$> sequence e)
246245 (clearScopes @ NExprLoc $ NSetAnn ann mempty <$> traverse sequence binds)
246+ (reduceLayer e)
247247 usesInherit
248248
249249-- Encountering a 'rec set' construction eliminates any hope of inlining
@@ -299,7 +299,7 @@ reduce (NLetAnnF ann binds body) =
299299reduce e@ (NIfAnnF _ b t f) =
300300 (\ case
301301 NConstantAnn _ (NBool b') -> bool f t b'
302- _ -> Fix <$> sequence e
302+ _ -> reduceLayer e
303303 ) =<< b
304304
305305-- | Reduce an assert atom to its encapsulated
@@ -322,7 +322,10 @@ reduce (NAbsAnnF ann params body) = do
322322 HM. fromList $ (\ (k, _) -> (k, NSymAnn ann k)) <$> pset
323323 NAbsAnn ann params' <$> pushScope scope body
324324
325- reduce v = Fix <$> sequence v
325+ reduce v = reduceLayer v
326+
327+ reduceLayer :: (Traversable f1 , Applicative f2 ) => f1 (f2 (Fix f1 )) -> f2 (Fix f1 )
328+ reduceLayer v = Fix <$> sequenceA v
326329
327330-- newtype FlaggedF f r = FlaggedF { flagged :: (IORef Bool, f r) }
328331newtype FlaggedF f r = FlaggedF (IORef Bool , f r )
0 commit comments