Since a case expression can introduce a binder (for its scrutinee), we
should be able to denote that in the CoreContext.
where
transalt :: CoreAlt -> TransformMonad CoreAlt
transalt (con, binders, expr) = do
- expr' <- trans (Other:c) expr
+ expr' <- trans ((CaseAlt b):c) expr
return (con, binders, expr')
subeverywhere trans c (Var x) = return $ Var x
| LambdaBody CoreSyn.CoreBndr
-- ^ The expression is the body of a
-- lambda abstraction
+ | CaseAlt CoreSyn.CoreBndr
+ -- ^ The expression is the body of a
+ -- case alternative.
| Other -- ^ Another context
deriving (Eq, Show)
-- | Transforms a CoreExpr and keeps track if it has changed.