egison-pattern-src-0.1.0.0: Manipulating Egison patterns: abstract syntax, parser, and pretty-printer

Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Language.Egison.Syntax.Pattern.Expr

Description

This module defines an AST (Abstract Syntax Tree) for Egison pattern expression.

Synopsis

Documentation

data Expr n v e Source #

Egison pattern expressions. n is a type for name references in patterns, such as them in pattern constructors. v is a type for name bindings in patterns, such as them in pattern variables. e is a type for expressions in patterns, such as them in value patterns.

Constructors

Wildcard

Wildcard pattern. Match with everything.

Variable v

Pattern variable. The matched term is bound to the name.

Value e

Value pattern. Match with equal terms.

Predicate e

Predicate pattern. Match with terms that satisfy the given predicate.

And (Expr n v e) (Expr n v e)

And pattern. Match when both patterns matches.

Or (Expr n v e) (Expr n v e)

Or pattern. Match when one of given patterns matches.

Not (Expr n v e)

Not pattern. Match when the given pattern does not match.

Infix n (Expr n v e) (Expr n v e)

User-defined infix pattern.

Pattern n [Expr n v e]

User-defined normal pattern.

Instances
(Eq v, Eq e, Eq n) => Eq (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

Methods

(==) :: Expr n v e -> Expr n v e -> Bool #

(/=) :: Expr n v e -> Expr n v e -> Bool #

(Data n, Data v, Data e) => Data (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Expr n v e -> c (Expr n v e) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Expr n v e) #

toConstr :: Expr n v e -> Constr #

dataTypeOf :: Expr n v e -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Expr n v e)) #

dataCast2 :: Typeable t => (forall d e0. (Data d, Data e0) => c (t d e0)) -> Maybe (c (Expr n v e)) #

gmapT :: (forall b. Data b => b -> b) -> Expr n v e -> Expr n v e #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr n v e -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr n v e -> r #

gmapQ :: (forall d. Data d => d -> u) -> Expr n v e -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Expr n v e -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Expr n v e -> m (Expr n v e) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr n v e -> m (Expr n v e) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr n v e -> m (Expr n v e) #

(Ord v, Ord e, Ord n) => Ord (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

Methods

compare :: Expr n v e -> Expr n v e -> Ordering #

(<) :: Expr n v e -> Expr n v e -> Bool #

(<=) :: Expr n v e -> Expr n v e -> Bool #

(>) :: Expr n v e -> Expr n v e -> Bool #

(>=) :: Expr n v e -> Expr n v e -> Bool #

max :: Expr n v e -> Expr n v e -> Expr n v e #

min :: Expr n v e -> Expr n v e -> Expr n v e #

(Show v, Show e, Show n) => Show (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

Methods

showsPrec :: Int -> Expr n v e -> ShowS #

show :: Expr n v e -> String #

showList :: [Expr n v e] -> ShowS #

Generic (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

Associated Types

type Rep (Expr n v e) :: Type -> Type #

Methods

from :: Expr n v e -> Rep (Expr n v e) x #

to :: Rep (Expr n v e) x -> Expr n v e #

Recursive (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Base

Methods

project :: Expr n v e -> Base (Expr n v e) (Expr n v e) #

cata :: (Base (Expr n v e) a -> a) -> Expr n v e -> a #

para :: (Base (Expr n v e) (Expr n v e, a) -> a) -> Expr n v e -> a #

gpara :: (Corecursive (Expr n v e), Comonad w) => (forall b. Base (Expr n v e) (w b) -> w (Base (Expr n v e) b)) -> (Base (Expr n v e) (EnvT (Expr n v e) w a) -> a) -> Expr n v e -> a #

prepro :: Corecursive (Expr n v e) => (forall b. Base (Expr n v e) b -> Base (Expr n v e) b) -> (Base (Expr n v e) a -> a) -> Expr n v e -> a #

gprepro :: (Corecursive (Expr n v e), Comonad w) => (forall b. Base (Expr n v e) (w b) -> w (Base (Expr n v e) b)) -> (forall c. Base (Expr n v e) c -> Base (Expr n v e) c) -> (Base (Expr n v e) (w a) -> a) -> Expr n v e -> a #

Corecursive (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Base

Methods

embed :: Base (Expr n v e) (Expr n v e) -> Expr n v e #

ana :: (a -> Base (Expr n v e) a) -> a -> Expr n v e #

apo :: (a -> Base (Expr n v e) (Either (Expr n v e) a)) -> a -> Expr n v e #

postpro :: Recursive (Expr n v e) => (forall b. Base (Expr n v e) b -> Base (Expr n v e) b) -> (a -> Base (Expr n v e) a) -> a -> Expr n v e #

gpostpro :: (Recursive (Expr n v e), Monad m) => (forall b. m (Base (Expr n v e) b) -> Base (Expr n v e) (m b)) -> (forall c. Base (Expr n v e) c -> Base (Expr n v e) c) -> (a -> Base (Expr n v e) (m a)) -> a -> Expr n v e #

type Rep (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Expr

type Rep (Expr n v e) = D1 (MetaData "Expr" "Language.Egison.Syntax.Pattern.Expr" "egison-pattern-src-0.1.0.0-EKV87hBGG8O2A8pHnh2PbK" False) (((C1 (MetaCons "Wildcard" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Variable" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 v))) :+: (C1 (MetaCons "Value" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 e)) :+: C1 (MetaCons "Predicate" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 e)))) :+: ((C1 (MetaCons "And" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e))) :+: C1 (MetaCons "Or" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e)))) :+: (C1 (MetaCons "Not" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e))) :+: (C1 (MetaCons "Infix" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 n) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Expr n v e)))) :+: C1 (MetaCons "Pattern" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 n) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Expr n v e]))))))
type Base (Expr n v e) Source # 
Instance details

Defined in Language.Egison.Syntax.Pattern.Base

type Base (Expr n v e) = ExprF n v e