on master help sign in
cosmetic: make shadow check a bet more compact
c480449Evan Czaplicki
compiler/Transform/Substitute.hs+3−5
@@ -21,13 +21,11 @@ subst old new expr =
21 MultiIf ps -> MultiIf (map (f *** f) ps)
21 MultiIf ps -> MultiIf (map (f *** f) ps)
22
22
23 Let defs body
23 Let defs body
24− | any hasShadow defs -> expr
24+ | anyShadow -> expr
25 | otherwise -> Let (map substDef defs) (f body)
25 | otherwise -> Let (map substDef defs) (f body)
26 where
26 where
27− hasShadow def =
27+ anyShadow =
28− case def of
29− TypeAnnotation _ _ -> False
30− Def pattern _ -> Set.member old (SD.boundVars pattern)
28+ any (Set.member old . SD.boundVars) [ p | Def p _ <- defs ]
31 substDef def =
29 substDef def =
32 case def of
30 case def of
33 TypeAnnotation _ _ -> def
31 TypeAnnotation _ _ -> def