Safe Haskell | None |
---|---|
Language | Haskell2010 |
Matcher definitions.
Something
matcher
Something built-in matcher.
The Something
matcher can handle only a pattern variable and a wildcard.
Instances
Matcher Something a Source # | |
Defined in Control.Egison.Matcher |
Eql
and Integer
matchers
class ValuePat m a where Source #
Value patterns.
A matcher for data types that are instances of Eq
.
The Eql
matcher can handle a pattern variable, a wildcard, and a value pattern.
A matcher for integers.
The Integer
matcher can handle a pattern variable, a wildcard, and a value pattern.
Pair
matcher
class PairPat m a where Source #
A pattern constructor for pairs.
pair :: (Matcher m a, a ~ (b1, b2), m ~ Pair m1 m2) => Pattern b1 m1 ctx xs -> Pattern b2 m2 (ctx :++: xs) ys -> Pattern a m ctx (xs :++: ys) Source #
A matcher for a pair of data.
Pair m1 m2 |
Matchers for collections
class CollectionPat m a where Source #
Patterns for collections.
nil :: Matcher m a => Pattern a m ctx '[] Source #
The nil
pattern matches an empty collection.
cons :: (Matcher m a, a ~ [a'], m ~ f m') => Pattern a' m' ctx xs -> Pattern a m (ctx :++: xs) ys -> Pattern a m ctx (xs :++: ys) Source #
The cons
pattern decomposes a collection into an element and the rest elements.
join :: Matcher m a => Pattern a m ctx xs -> Pattern a m (ctx :++: xs) ys -> Pattern a m ctx (xs :++: ys) Source #
The join
pattern decomposes a collection into two collections.
Instances
Matcher m a => CollectionPat (Set m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (Set m) [a] => Pattern [a] (Set m) ctx [] Source # cons :: (Matcher (Set m) [a], [a] ~ [a'], Set m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (Set m) (ctx :++: xs) ys -> Pattern [a] (Set m) ctx (xs :++: ys) Source # join :: Matcher (Set m) [a] => Pattern [a] (Set m) ctx xs -> Pattern [a] (Set m) (ctx :++: xs) ys -> Pattern [a] (Set m) ctx (xs :++: ys) Source # | |
Matcher m a => CollectionPat (Multiset m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (Multiset m) [a] => Pattern [a] (Multiset m) ctx [] Source # cons :: (Matcher (Multiset m) [a], [a] ~ [a'], Multiset m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (Multiset m) (ctx :++: xs) ys -> Pattern [a] (Multiset m) ctx (xs :++: ys) Source # join :: Matcher (Multiset m) [a] => Pattern [a] (Multiset m) ctx xs -> Pattern [a] (Multiset m) (ctx :++: xs) ys -> Pattern [a] (Multiset m) ctx (xs :++: ys) Source # | |
Matcher m a => CollectionPat (List m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (List m) [a] => Pattern [a] (List m) ctx [] Source # cons :: (Matcher (List m) [a], [a] ~ [a'], List m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (List m) (ctx :++: xs) ys -> Pattern [a] (List m) ctx (xs :++: ys) Source # join :: Matcher (List m) [a] => Pattern [a] (List m) ctx xs -> Pattern [a] (List m) (ctx :++: xs) ys -> Pattern [a] (List m) ctx (xs :++: ys) Source # |
A matcher for a list.
List m |
Instances
Matcher m a => Matcher (List m) [a] Source # | |
Defined in Control.Egison.Matcher | |
Matcher m a => CollectionPat (List m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (List m) [a] => Pattern [a] (List m) ctx [] Source # cons :: (Matcher (List m) [a], [a] ~ [a'], List m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (List m) (ctx :++: xs) ys -> Pattern [a] (List m) ctx (xs :++: ys) Source # join :: Matcher (List m) [a] => Pattern [a] (List m) ctx xs -> Pattern [a] (List m) (ctx :++: xs) ys -> Pattern [a] (List m) ctx (xs :++: ys) Source # | |
(Matcher m a, Eq a, ValuePat m a) => ValuePat (List m) [a] Source # | |
A matcher for a multiset. When we regard a collection as a multiset, the order of elements is ignored but the number of times an element appears in the collection is counted.
Multiset m |
Instances
Matcher m a => Matcher (Multiset m) [a] Source # | |
Defined in Control.Egison.Matcher | |
Matcher m a => CollectionPat (Multiset m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (Multiset m) [a] => Pattern [a] (Multiset m) ctx [] Source # cons :: (Matcher (Multiset m) [a], [a] ~ [a'], Multiset m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (Multiset m) (ctx :++: xs) ys -> Pattern [a] (Multiset m) ctx (xs :++: ys) Source # join :: Matcher (Multiset m) [a] => Pattern [a] (Multiset m) ctx xs -> Pattern [a] (Multiset m) (ctx :++: xs) ys -> Pattern [a] (Multiset m) ctx (xs :++: ys) Source # | |
(Matcher m a, Eq a, ValuePat m a) => ValuePat (Multiset m) [a] Source # | |
A matcher for a set. Both the order and the repetition of elements are ignored.
Set m |
Instances
Matcher m a => Matcher (Set m) [a] Source # | |
Defined in Control.Egison.Matcher | |
Matcher m a => CollectionPat (Set m) [a] Source # | |
Defined in Control.Egison.Matcher nil :: Matcher (Set m) [a] => Pattern [a] (Set m) ctx [] Source # cons :: (Matcher (Set m) [a], [a] ~ [a'], Set m ~ f m') => Pattern a' m' ctx xs -> Pattern [a] (Set m) (ctx :++: xs) ys -> Pattern [a] (Set m) ctx (xs :++: ys) Source # join :: Matcher (Set m) [a] => Pattern [a] (Set m) ctx xs -> Pattern [a] (Set m) (ctx :++: xs) ys -> Pattern [a] (Set m) ctx (xs :++: ys) Source # | |
(Matcher m a, Eq a, Ord a, ValuePat m a) => ValuePat (Set m) [a] Source # | |