| Safe Haskell | None |
|---|
HERMIT.Dictionary.Local.Let
Contents
- externals :: [External]
- letNonRecSubstR :: MonadCatch m => Rewrite c m CoreExpr
- letNonRecSubstSafeR :: forall c m. (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, MonadCatch m) => Rewrite c m CoreExpr
- letSubstR :: (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, MonadCatch m) => Rewrite c m CoreExpr
- letSubstSafeR :: (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, MonadCatch m) => Rewrite c m CoreExpr
- letElimR :: (ExtendPath c Crumb, AddBindings c, MonadCatch m) => Rewrite c m CoreExpr
- letNonRecElimR :: MonadCatch m => Rewrite c m CoreExpr
- letRecElimR :: MonadCatch m => Rewrite c m CoreExpr
- progBindElimR :: MonadCatch m => Rewrite c m CoreProg
- progBindNonRecElimR :: MonadCatch m => Rewrite c m CoreProg
- progBindRecElimR :: MonadCatch m => Rewrite c m CoreProg
- letIntroR :: String -> Rewrite c HermitM CoreExpr
- letFloatAppR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatArgR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatLetR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatLamR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatCaseR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatCastR :: MonadCatch m => Rewrite c m CoreExpr
- letFloatExprR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr
- letFloatTopR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreProg
- letFloatInR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExpr
- letFloatInAppR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExpr
- letFloatInCaseR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExpr
- letFloatInLamR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, MonadCatch m) => Rewrite c m CoreExpr
- reorderNonRecLetsR :: MonadCatch m => [Name] -> Rewrite c m CoreExpr
- letTupleR :: String -> Rewrite c HermitM CoreExpr
- letToCaseR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c) => Rewrite c HermitM CoreExpr
Rewrites on Let Expressions
Let Elimination
letNonRecSubstR :: MonadCatch m => Rewrite c m CoreExprSource
Let (NonRec v e) body ==> body[e/v]
letNonRecSubstSafeR :: forall c m. (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, MonadCatch m) => Rewrite c m CoreExprSource
Currently we always substitute types and coercions, and use a heuristic to decide whether to substitute expressions. This may need revisiting.
letSubstR :: (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, MonadCatch m) => Rewrite c m CoreExprSource
(let x = e1 in e2) ==> (e2[e1/x]), (x must not be free in e1)
letSubstSafeR :: (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, MonadCatch m) => Rewrite c m CoreExprSource
As letNonRecSubstSafeR, but attempting to convert a singleton recursive binding to a non-recursive binding first.
letElimR :: (ExtendPath c Crumb, AddBindings c, MonadCatch m) => Rewrite c m CoreExprSource
letNonRecElimR :: MonadCatch m => Rewrite c m CoreExprSource
Remove an unused non-recursive let binding.
let v = E1 in E2 ==> E2, if v is not free in E2
letRecElimR :: MonadCatch m => Rewrite c m CoreExprSource
Remove all unused recursive let bindings in the current group.
progBindElimR :: MonadCatch m => Rewrite c m CoreProgSource
progBindNonRecElimR :: MonadCatch m => Rewrite c m CoreProgSource
progBindRecElimR :: MonadCatch m => Rewrite c m CoreProgSource
Remove all unused bindings at the top level.
Let Introduction
letIntroR :: String -> Rewrite c HermitM CoreExprSource
e ==> (let v = e in v), name of v is provided
Let Floating Out
letFloatAppR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
(let v = ev in e) x ==> let v = ev in e x
letFloatArgR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
f (let v = ev in e) ==> let v = ev in f e
letFloatLetR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
let v = (let bds in e1) in e2 ==> let bds in let v = e1 in e2
letFloatLamR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
( v -> let binds in e2) ==> let binds in ( v1 -> e2)
Fails if v occurs in the RHS of binds.
If v is shadowed in binds, then v will be alpha-renamed.
letFloatCaseR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
case (let bnds in e) of wild alts ==> let bnds in (case e of wild alts)
Fails if any variables bound in bnds occurs in alts.
letFloatCastR :: MonadCatch m => Rewrite c m CoreExprSource
cast (let bnds in e) co ==> let bnds in cast e co
letFloatExprR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExprSource
Float a Let through an expression, whatever the context.
letFloatTopR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreProgSource
Let Floating In
letFloatInR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExprSource
Float in a Let if possible.
letFloatInAppR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExprSource
let v = ev in f a ==> (let v = ev in f) (let v = ev in a)
letFloatInCaseR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExprSource
let v = ev in case s of p -> e ==> case (let v = ev in s) of p -> let v = ev in e,
if v does not shadow a pattern binder in p
letFloatInLamR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, MonadCatch m) => Rewrite c m CoreExprSource
let v = ev in x -> e ==> x -> let v = ev in e
if v does not shadow x
Miscallaneous
reorderNonRecLetsR :: MonadCatch m => [Name] -> Rewrite c m CoreExprSource
Re-order a sequence of nested non-recursive let bindings. The argument list should contain the let-bound variables, in the desired order.
letTupleR :: String -> Rewrite c HermitM CoreExprSource
Combine nested non-recursive lets into case of a tuple. E.g. let {v1 = e1 ; v2 = e2 ; v3 = e3} in body ==> case (e1,e2,e3) of {(v1,v2,v3) -> body}
letToCaseR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c) => Rewrite c HermitM CoreExprSource
let v = ev in e ==> case ev of v -> e