Portability  nonportable (see .cabal) 

Stability  experimental 
Maintainer  Brent Yorgey <byorgey@cis.upenn.edu> 
Safe Haskell  None 
 newtype Pattern vars a = Pattern {
 runPattern :: a > Maybe (Tuple vars)
 data Clause a r
 runClause :: Clause a r > ReaderT a Maybe r
 (>>) :: Pattern vars a > Fun vars r > Clause a r
 (<>) :: Alternative f => forall a. f a > f a > f a
 module Data.Pattern.Base.TypeList
 module Data.Pattern.Base.Tuple
Patterns
The pattern type. A value of type Pattern vars a
is a pattern
which matches values of type a
and binds variables with types
given by the typelist vars
. For example, something of type
Pattern (a :*: c :*: Nil) (a,b,c)
is a pattern which matches against a triple and binds values of
types a
and c
. (A pattern of this type can be constructed as
tup3 var __ var
.)
Many "normal" patterns can be conveniently defined using mk0
,
mk1
, mk2
, and so on.
Pattern  

Clauses
Patternmatch clauses. Typically something of the form
pattern >>
function
where the function takes one argument for each variable bound by the pattern.
Clauses can be constructed with (
, run with >>
)tryMatch
,
and manipulated by the Monad
and MonadPlus
instances. In
particular, the (
operator from the <>
)Alternative
class
is the way to list multiple cases in a pattern.
Monad (Clause a)  
Functor (Clause a)  
MonadPlus (Clause a)  
Applicative (Clause a)  
Alternative (Clause a) 
runClause :: Clause a r > ReaderT a Maybe rSource
Extract the underlying computation
constituting a Clause
. This
function is not intended to be used
directly; instead, see match
,
tryMatch
, mmatch
, and elim
from
Data.Pattern.Common.
(>>) :: Pattern vars a > Fun vars r > Clause a rSource
Construct a Clause
from a pattern and a function which takes
one argument for each variable bound by the pattern. For example,
pair __ nothing >> 3 pair var nothing >> \x > x + 3 pair var (just var) >> \x y > x + y + 3
(<>) :: Alternative f => forall a. f a > f a > f a
An associative binary operation
Internals
module Data.Pattern.Base.TypeList
module Data.Pattern.Base.Tuple