Safe Haskell | None |
---|---|
Language | Haskell2010 |
- externals :: [External]
- letNonRecSubstR :: MonadCatch m => Rewrite c m CoreExpr
- letNonRecSubstSafeR :: forall c m. (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, HasEmptyContext 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, HasEmptyContext 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
- letNonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM CoreExpr
- progNonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM CoreProg
- nonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM Core
- letIntroUnfoldingR :: (BoundVars c, ReadBindings c) => 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 => [String] -> 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 CoreExpr Source
Let (NonRec v e) body
==> body[e/v]
letNonRecSubstSafeR :: forall c m. (AddBindings c, ExtendPath c Crumb, ReadPath c Crumb, ReadBindings c, HasEmptyContext c, MonadCatch m) => Rewrite c m CoreExpr Source
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 CoreExpr Source
(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, HasEmptyContext c, MonadCatch m) => Rewrite c m CoreExpr Source
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 CoreExpr Source
letNonRecElimR :: MonadCatch m => Rewrite c m CoreExpr Source
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 CoreExpr Source
Remove all unused recursive let bindings in the current group.
progBindElimR :: MonadCatch m => Rewrite c m CoreProg Source
progBindNonRecElimR :: MonadCatch m => Rewrite c m CoreProg Source
progBindRecElimR :: MonadCatch m => Rewrite c m CoreProg Source
Remove all unused bindings at the top level.
Let Introduction
letNonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM CoreExpr Source
body
==> let v = e in body
progNonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM CoreProg Source
prog
==> ProgCons
(v = e) prog
nonRecIntroR :: String -> CoreExpr -> Rewrite c HermitM Core Source
nonRecIntroR nm e = 'letNonRecIntroR nm e' <+ 'progNonRecIntroR nm e'
letIntroUnfoldingR :: (BoundVars c, ReadBindings c) => String -> Rewrite c HermitM CoreExpr Source
Introduce a local definition for a (possibly imported) identifier. Rewrites occurences of the identifier to point to this new local definiton.
Let Floating Out
letFloatAppR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreExpr Source
(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 CoreExpr Source
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 CoreExpr Source
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 CoreExpr Source
( 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 CoreExpr Source
case (let bnds in e) of bndr alts
==> let bnds in (case e of bndr alts)
Fails if any variables bound in bnds
occurs in alts
.
letFloatCastR :: MonadCatch m => Rewrite c m CoreExpr Source
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 CoreExpr Source
Float a Let
through an expression, whatever the context.
letFloatTopR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c) => Rewrite c HermitM CoreProg Source
Let Floating In
letFloatInR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExpr Source
Float in a Let
if possible.
letFloatInAppR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb) => Rewrite c HermitM CoreExpr Source
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 CoreExpr Source
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 CoreExpr Source
let v = ev in x -> e
==> x -> let v = ev in e
if v
does not shadow x
Miscallaneous
reorderNonRecLetsR :: MonadCatch m => [String] -> Rewrite c m CoreExpr Source
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 CoreExpr Source
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 CoreExpr Source
let v = ev in e
==> case ev of v -> e