hermit-0.7.1.0: Haskell Equational Reasoning Model-to-Implementation Tunnel

Safe HaskellNone
LanguageHaskell2010

HERMIT.Dictionary.Inline

Contents

Synopsis

Inlining

externals :: [External] Source

Externals for inlining variables.

getUnfoldingT :: (ReadBindings c, MonadCatch m) => InlineConfig -> Transform c m Id (CoreExpr, BindingDepth -> Bool) Source

Return the unfolding of an identifier, and a predicate over the binding depths of all variables within that unfolding to determine if they have been captured in their new location.

ensureBoundT :: (Monad m, ReadBindings c) => Transform c m CoreExpr () Source

Check that all free variables in an expression are bound. Fails, listing unbound variables if not.

inlineNameR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => String -> Rewrite c m CoreExpr Source

If the current variable matches the given name, then inline it.

inlineNamesR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => [String] -> Rewrite c m CoreExpr Source

If the current variable matches any of the given names, then inline it.

inlineMatchingPredR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => (Id -> Bool) -> Rewrite c m CoreExpr Source

If the current variable satisifies the predicate, then inline it.

inlineCaseScrutineeR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => Rewrite c m CoreExpr Source

Inline the current identifier if it is a case binder, using the scrutinee rather than the case-alternative pattern.

inlineCaseAlternativeR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => Rewrite c m CoreExpr Source

Inline the current identifier if is a case binder, using the case-alternative pattern rather than the scrutinee.

configurableInlineR Source

Arguments

:: (AddBindings c, ExtendPath c Crumb, HasEmptyContext c, ReadBindings c, ReadPath c Crumb, MonadCatch m) 
=> InlineConfig 
-> Transform c m Id Bool

Only inline identifiers that satisfy this predicate.

-> Rewrite c m CoreExpr 

The implementation of inline, an important transformation. This *only* works if the current expression has the form Var v (it does not traverse the expression). It can trivially be prompted to more general cases using traversal strategies.

inlineTargetsT :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, ReadBindings c, HasEmptyContext c, MonadCatch m) => Transform c m LCore [String] Source

Get list of possible inline targets. Used by shell for completion.