Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The module exposes two QuasiQuoter
s named anypat
and maypat
that allow compiling separate patterns into a single (view) pattern that
will fire in case any of the patterns matches. If there are any variable names, it will match these. For the anypat
it requires that all
variables occur in all patterns. For maypat
that is not a requirement. For both QuasiQuoter
s, it is however required that the variables
have the same type in each pattern.
Quasiquoters
:: QuasiQuoter | The quasiquoter that can be used as pattern. |
A quasquoter to specify multiple patterns that will succeed if any of the patterns match. All patterns should have the same set of variables and these should have the same type, otherwise a variable would have two different types, and if a variable is absent in one of the patterns, the question is what to pass as value.
:: QuasiQuoter | The quasiquoter that can be used as pattern. |
A quasiquoter to specify multiple patterns that will succeed if any of these patterns match. Patterns don't have to have the same variable names but if a variable is shared over the
different patterns, it should have the same type. In case a variable name does not appear in all patterns, it will be passed as a Maybe
to the clause with Nothing
if a pattern matched
without that variable name, and a Just
if the (first) pattern that matched had such variable.
derive variable names names from patterns
:: Pat | The |
-> [Name] | The list of variable names that is used to collect (fragments) of the pattern. |
Provides a list of variable names for a given Pat
tern. The list is not sorted. If the same variable name occurs multiple times (which does not make much sense), it will be listed multiple times.
:: Pat | The |
-> [Name] | The list of remaining elements that is added as tail. |
-> [Name] | The list of variable names that is used to collect (fragments) of the pattern. |
Provides a list of variable names for a given Pat
tern. The list is not sorted. If the same variable name occurs multiple times (which does not make much sense), it will be listed multiple times.