Safe Haskell | None |
---|---|
Language | Haskell2010 |
Pinchot.RecursiveDo
Description
Emulating recursive do notation, as TH does not support it.
Documentation
lazyPattern :: Foldable c => c Name -> Q Pat Source
Creates a lazy pattern for all the given names. Adds an empty
pattern onto the front. This is the counterpart of bigTuple
.
All of the given names are bound. In addition, a single,
wildcard pattern is bound to the front.
For example, lazyPattern (map mkName ["x", "y", "z"])
gives a
pattern that looks like
~(_, (x, (y, (z, ()))))
The idea is that the named patterns are needed so that the
recursive do
notation works, and that the wildcard pattern is
the return value, which is not needed here.
Arguments
:: Foldable c | |
=> ExpQ | This expression will be the first one in the tuple. |
-> c ExpQ | Remaining expressions in the tuple. |
-> ExpQ |
Creates a big tuple. It is nested in the second element, such as (1, (2, (3, (4, ())))). Thus, the big tuple is terminated with a unit value. It resembles a list where each tuple is a cons cell and the terminator is unit.
Arguments
:: [(Name, ExpQ)] | Binding statements |
-> ExpQ | Final return value from |
-> ExpQ | Returns an expression whose value is the final return value
from the |
Builds a recursive do
expression (because TH has no support
for mdo
notation).