sweet-egison-0.1.1.3: Shallow embedding implementation of non-linear pattern matching

Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Control.Egison.Matcher.Collection

Description

 
Synopsis

Documentation

class CollectionPattern m t where Source #

Class for collection pattern constructors.

Minimal complete definition

nil, cons, consM, join, elm, elmM, joinCons, joinConsM

Associated Types

type ElemM m Source #

Matcher for the elements.

type ElemT t Source #

Type of the target elements.

Methods

nil :: Pattern () m t () Source #

Pattern that matches with empty collections. [] is desugared into nil by the quasi-quoter.

nilM :: m -> t -> () Source #

nilM :: m -> t -> () Source #

cons :: Pattern (PP (ElemT t), PP t) m t (ElemT t, t) Source #

Pattern that destructs collections into its head and tail. : is desugared into cons by the quasi-quoter.

consM :: m -> t -> (ElemM m, m) Source #

join :: Pattern (PP t, PP t) m t (t, t) Source #

Pattern that destructs collections into its initial prefix and remaining suffix. ++ is desugared into join by the quasi-quoter.

joinM :: m -> t -> (m, m) Source #

joinM :: m -> t -> (m, m) Source #

elm :: Pattern (PP (ElemT t)) m t (ElemT t) Source #

elmM :: m -> t -> ElemM m Source #

joinCons :: Pattern (PP t, PP (ElemT t), PP t) m t (t, ElemT t, t) Source #

joinConsM :: m -> t -> (m, ElemM m, m) Source #

Instances
Matcher m t => CollectionPattern (Set m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (Set m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (Set m) [t] () Source #

nilM :: Set m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (Set m) [t] (ElemT [t], [t]) Source #

consM :: Set m -> [t] -> (ElemM (Set m), Set m) Source #

join :: Pattern (PP [t], PP [t]) (Set m) [t] ([t], [t]) Source #

joinM :: Set m -> [t] -> (Set m, Set m) Source #

elm :: Pattern (PP (ElemT [t])) (Set m) [t] (ElemT [t]) Source #

elmM :: Set m -> [t] -> ElemM (Set m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (Set m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: Set m -> [t] -> (Set m, ElemM (Set m), Set m) Source #

Matcher m t => CollectionPattern (Multiset m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (Multiset m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (Multiset m) [t] () Source #

nilM :: Multiset m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (Multiset m) [t] (ElemT [t], [t]) Source #

consM :: Multiset m -> [t] -> (ElemM (Multiset m), Multiset m) Source #

join :: Pattern (PP [t], PP [t]) (Multiset m) [t] ([t], [t]) Source #

joinM :: Multiset m -> [t] -> (Multiset m, Multiset m) Source #

elm :: Pattern (PP (ElemT [t])) (Multiset m) [t] (ElemT [t]) Source #

elmM :: Multiset m -> [t] -> ElemM (Multiset m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (Multiset m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: Multiset m -> [t] -> (Multiset m, ElemM (Multiset m), Multiset m) Source #

Matcher m t => CollectionPattern (List m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (List m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (List m) [t] () Source #

nilM :: List m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (List m) [t] (ElemT [t], [t]) Source #

consM :: List m -> [t] -> (ElemM (List m), List m) Source #

join :: Pattern (PP [t], PP [t]) (List m) [t] ([t], [t]) Source #

joinM :: List m -> [t] -> (List m, List m) Source #

elm :: Pattern (PP (ElemT [t])) (List m) [t] (ElemT [t]) Source #

elmM :: List m -> [t] -> ElemM (List m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (List m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: List m -> [t] -> (List m, ElemM (List m), List m) Source #

newtype List m Source #

List matcher is a matcher for collections that matches as if they're normal lists.

Constructors

List m 
Instances
(Eq a, Matcher m a, ValuePattern m a) => ValuePattern (List m) [a] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Methods

value :: [a] -> Pattern () (List m) [a] () Source #

valueM :: List m -> [a] -> () Source #

Matcher m t => CollectionPattern (List m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (List m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (List m) [t] () Source #

nilM :: List m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (List m) [t] (ElemT [t], [t]) Source #

consM :: List m -> [t] -> (ElemM (List m), List m) Source #

join :: Pattern (PP [t], PP [t]) (List m) [t] ([t], [t]) Source #

joinM :: List m -> [t] -> (List m, List m) Source #

elm :: Pattern (PP (ElemT [t])) (List m) [t] (ElemT [t]) Source #

elmM :: List m -> [t] -> ElemM (List m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (List m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: List m -> [t] -> (List m, ElemM (List m), List m) Source #

Matcher m t => Matcher (List m :: Type) ([t] :: Type) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (List m) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (List m) = m

newtype Multiset m Source #

Constructors

Multiset m 
Instances
(Eq a, Matcher m a, ValuePattern m a) => ValuePattern (Multiset m) [a] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Methods

value :: [a] -> Pattern () (Multiset m) [a] () Source #

valueM :: Multiset m -> [a] -> () Source #

Matcher m t => CollectionPattern (Multiset m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (Multiset m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (Multiset m) [t] () Source #

nilM :: Multiset m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (Multiset m) [t] (ElemT [t], [t]) Source #

consM :: Multiset m -> [t] -> (ElemM (Multiset m), Multiset m) Source #

join :: Pattern (PP [t], PP [t]) (Multiset m) [t] ([t], [t]) Source #

joinM :: Multiset m -> [t] -> (Multiset m, Multiset m) Source #

elm :: Pattern (PP (ElemT [t])) (Multiset m) [t] (ElemT [t]) Source #

elmM :: Multiset m -> [t] -> ElemM (Multiset m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (Multiset m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: Multiset m -> [t] -> (Multiset m, ElemM (Multiset m), Multiset m) Source #

Matcher m t => Matcher (Multiset m :: Type) ([t] :: Type) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (Multiset m) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (Multiset m) = m

newtype Set m Source #

Constructors

Set m 
Instances
(Eq a, Matcher m a, ValuePattern m a) => ValuePattern (Set m) [a] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Methods

value :: [a] -> Pattern () (Set m) [a] () Source #

valueM :: Set m -> [a] -> () Source #

Matcher m t => CollectionPattern (Set m) [t] Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

Associated Types

type ElemM (Set m) :: Type Source #

type ElemT [t] :: Type Source #

Methods

nil :: Pattern () (Set m) [t] () Source #

nilM :: Set m -> [t] -> () Source #

cons :: Pattern (PP (ElemT [t]), PP [t]) (Set m) [t] (ElemT [t], [t]) Source #

consM :: Set m -> [t] -> (ElemM (Set m), Set m) Source #

join :: Pattern (PP [t], PP [t]) (Set m) [t] ([t], [t]) Source #

joinM :: Set m -> [t] -> (Set m, Set m) Source #

elm :: Pattern (PP (ElemT [t])) (Set m) [t] (ElemT [t]) Source #

elmM :: Set m -> [t] -> ElemM (Set m) Source #

joinCons :: Pattern (PP [t], PP (ElemT [t]), PP [t]) (Set m) [t] ([t], ElemT [t], [t]) Source #

joinConsM :: Set m -> [t] -> (Set m, ElemM (Set m), Set m) Source #

Matcher m t => Matcher (Set m :: Type) ([t] :: Type) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (Set m) Source # 
Instance details

Defined in Control.Egison.Matcher.Collection

type ElemM (Set m) = m