Safe Haskell | Safe-Infered |
---|
Utilities for constructing and destructing compound expressions.
- bindsOfLets :: Lets a n -> [Bind n]
- specBindsOfLets :: Lets a n -> [Bind n]
- valwitBindsOfLets :: Lets a n -> [Bind n]
- bindsOfPat :: Pat n -> [Bind n]
- makeXLAMs :: a -> [Bind n] -> Exp a n -> Exp a n
- takeXLAMs :: Exp a n -> Maybe ([Bind n], Exp a n)
- makeXLams :: a -> [Bind n] -> Exp a n -> Exp a n
- takeXLams :: Exp a n -> Maybe ([Bind n], Exp a n)
- takeXLamFlags :: Exp a n -> Maybe ([(Bool, Bind n)], Exp a n)
- makeXLamFlags :: a -> [(Bool, Bind n)] -> Exp a n -> Exp a n
- makeXApps :: a -> Exp a n -> [Exp a n] -> Exp a n
- takeXApps :: Exp a n -> [Exp a n]
- takeXConApps :: Exp a n -> Maybe (Bound n, [Exp a n])
- takeXPrimApps :: Exp a n -> Maybe (n, [Exp a n])
- takeCtorNameOfAlt :: Alt a n -> Maybe n
Lets
bindsOfLets :: Lets a n -> [Bind n]Source
Take the binds of a Lets
.
specBindsOfLets :: Lets a n -> [Bind n]Source
Like bindsOfLets
but only take the type binders.
valwitBindsOfLets :: Lets a n -> [Bind n]Source
Like bindsOfLets
but only take the value and witness binders.
Patterns
bindsOfPat :: Pat n -> [Bind n]Source
Take the binds of a Pat
.
Lambdas
takeXLAMs :: Exp a n -> Maybe ([Bind n], Exp a n)Source
Split nested value and witness lambdas from the front of an expression,
or Nothing
if there aren't any.
makeXLams :: a -> [Bind n] -> Exp a n -> Exp a nSource
Make some nested value or witness lambda abstractions.
takeXLams :: Exp a n -> Maybe ([Bind n], Exp a n)Source
Split nested value or witness lambdas from the front of an expression,
or Nothing
if there aren't any.
takeXLamFlags :: Exp a n -> Maybe ([(Bool, Bind n)], Exp a n)Source
Split nested lambdas from the front of an expression, with a flag indicating whether the lambda was a level-1 (True), or level-0 (False) binder.
makeXLamFlags :: a -> [(Bool, Bind n)] -> Exp a n -> Exp a nSource
Make some nested lambda abstractions, using a flag to indicate whether the lambda is a level-1 (True), or level-0 (False) binder.
Applications
takeXApps :: Exp a n -> [Exp a n]Source
Flatten an application into the function parts and arguments, if any.
takeXConApps :: Exp a n -> Maybe (Bound n, [Exp a n])Source
Flatten an application of a data constructor into the constructor and its arguments.
Returns Nothing
if the expression isn't a constructor application.
takeXPrimApps :: Exp a n -> Maybe (n, [Exp a n])Source
Flatten an application of a primop into the variable and its arguments.
Returns Nothing
if the expression isn't a primop application.
Alternatives
takeCtorNameOfAlt :: Alt a n -> Maybe nSource
Take the constructor name of an alternative, if there is one.