egison-3.7.13: Programming language with non-linear pattern-matching against non-free data

CopyrightSatoshi Egi
LicenseMIT
Safe HaskellNone
LanguageHaskell98

Language.Egison.Types

Contents

Description

This module contains type definitions of Egison Data.

Synopsis

Egison expressions

data EgisonExpr Source #

Constructors

CharExpr Char 
StringExpr Text 
BoolExpr Bool 
IntegerExpr Integer 
FloatExpr Double Double 
VarExpr Var 
FreshVarExpr 
IndexedExpr Bool EgisonExpr [Index EgisonExpr] 
SubrefsExpr Bool EgisonExpr EgisonExpr 
SuprefsExpr Bool EgisonExpr EgisonExpr 
UserrefsExpr Bool EgisonExpr EgisonExpr 
PowerExpr EgisonExpr EgisonExpr 
InductiveDataExpr String [EgisonExpr] 
TupleExpr [EgisonExpr] 
CollectionExpr [InnerExpr] 
ArrayExpr [EgisonExpr] 
HashExpr [(EgisonExpr, EgisonExpr)] 
VectorExpr [EgisonExpr] 
LambdaExpr [Arg] EgisonExpr 
LambdaArgExpr [Char] 
MemoizedLambdaExpr [String] EgisonExpr 
MemoizeExpr [(EgisonExpr, EgisonExpr, EgisonExpr)] EgisonExpr 
CambdaExpr String EgisonExpr 
ProcedureExpr [String] EgisonExpr 
MacroExpr [String] EgisonExpr 
PatternFunctionExpr [String] EgisonPattern 
IfExpr EgisonExpr EgisonExpr EgisonExpr 
LetRecExpr [BindingExpr] EgisonExpr 
LetExpr [BindingExpr] EgisonExpr 
LetStarExpr [BindingExpr] EgisonExpr 
WithSymbolsExpr [String] EgisonExpr 
MatchExpr EgisonExpr EgisonExpr [MatchClause] 
MatchAllExpr EgisonExpr EgisonExpr [MatchClause] 
MatchLambdaExpr EgisonExpr [MatchClause] 
MatchAllLambdaExpr EgisonExpr [MatchClause] 
NextMatchExpr EgisonExpr EgisonExpr [MatchClause] 
NextMatchAllExpr EgisonExpr EgisonExpr MatchClause 
NextMatchLambdaExpr EgisonExpr [MatchClause] 
NextMatchAllLambdaExpr EgisonExpr MatchClause 
MatcherExpr MatcherInfo 
MatcherDFSExpr MatcherInfo 
AlgebraicDataMatcherExpr [(String, [EgisonExpr])] 
QuoteExpr EgisonExpr 
QuoteSymbolExpr EgisonExpr 
WedgeExpr EgisonExpr 
WedgeApplyExpr EgisonExpr EgisonExpr 
DoExpr [BindingExpr] EgisonExpr 
IoExpr EgisonExpr 
SeqExpr EgisonExpr EgisonExpr 
ApplyExpr EgisonExpr EgisonExpr 
CApplyExpr EgisonExpr EgisonExpr 
PartialExpr Integer EgisonExpr 
PartialVarExpr Integer 
RecVarExpr 
GenerateArrayExpr EgisonExpr (EgisonExpr, EgisonExpr) 
ArrayBoundsExpr EgisonExpr 
ArrayRefExpr EgisonExpr EgisonExpr 
ParExpr EgisonExpr EgisonExpr 
PseqExpr EgisonExpr EgisonExpr 
PmapExpr EgisonExpr EgisonExpr 
GenerateTensorExpr EgisonExpr EgisonExpr 
TensorExpr EgisonExpr EgisonExpr EgisonExpr EgisonExpr 
TensorContractExpr EgisonExpr EgisonExpr 
TensorMapExpr EgisonExpr EgisonExpr 
TensorMap2Expr EgisonExpr EgisonExpr EgisonExpr 
TransposeExpr EgisonExpr EgisonExpr 
FlipIndicesExpr EgisonExpr 
FunctionExpr [EgisonExpr] 
SymbolicTensorExpr [EgisonExpr] EgisonExpr String 
SomethingExpr 
UndefinedExpr 

data Arg Source #

Instances
Eq Arg Source # 
Instance details

Defined in Language.Egison.Types

Methods

(==) :: Arg -> Arg -> Bool #

(/=) :: Arg -> Arg -> Bool #

Show Arg Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> Arg -> ShowS #

show :: Arg -> String #

showList :: [Arg] -> ShowS #

data Index a Source #

Instances
Eq a => Eq (Index a) Source # 
Instance details

Defined in Language.Egison.Types

Methods

(==) :: Index a -> Index a -> Bool #

(/=) :: Index a -> Index a -> Bool #

Show (Index ()) Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> Index () -> ShowS #

show :: Index () -> String #

showList :: [Index ()] -> ShowS #

Show (Index String) Source # 
Instance details

Defined in Language.Egison.Types

Show (Index ScalarData) Source # 
Instance details

Defined in Language.Egison.Types

Show (Index EgisonValue) Source # 
Instance details

Defined in Language.Egison.Types

Show (Index EgisonExpr) Source # 
Instance details

Defined in Language.Egison.Types

Generic (Index a) Source # 
Instance details

Defined in Language.Egison.Types

Associated Types

type Rep (Index a) :: Type -> Type #

Methods

from :: Index a -> Rep (Index a) x #

to :: Rep (Index a) x -> Index a #

Hashable (Index ()) Source # 
Instance details

Defined in Language.Egison.Types

Methods

hashWithSalt :: Int -> Index () -> Int #

hash :: Index () -> Int #

type Rep (Index a) Source # 
Instance details

Defined in Language.Egison.Types

type Rep (Index a) = D1 (MetaData "Index" "Language.Egison.Types" "egison-3.7.13-F5Efag1klsw4akcrVFOOvf" False) (((C1 (MetaCons "Subscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "Superscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) :+: (C1 (MetaCons "SupSubscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "MultiSubscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))) :+: ((C1 (MetaCons "MultiSuperscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "DFscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer))) :+: (C1 (MetaCons "Userscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: (C1 (MetaCons "DotSubscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "DotSupscript" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))))

class EgisonData a where Source #

Instances
EgisonData Bool Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Char Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Double Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Integer Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Rational Source # 
Instance details

Defined in Language.Egison.Types

EgisonData () Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Handle Source # 
Instance details

Defined in Language.Egison.Types

EgisonData Text Source # 
Instance details

Defined in Language.Egison.Types

EgisonData a => EgisonData [a] Source # 
Instance details

Defined in Language.Egison.Types

(EgisonData a, EgisonData b) => EgisonData (a, b) Source # 
Instance details

Defined in Language.Egison.Types

(EgisonData a, EgisonData b, EgisonData c) => EgisonData (a, b, c) Source # 
Instance details

Defined in Language.Egison.Types

Methods

toEgison :: (a, b, c) -> EgisonValue Source #

fromEgison :: EgisonValue -> EgisonM (a, b, c) Source #

(EgisonData a, EgisonData b, EgisonData c, EgisonData d) => EgisonData (a, b, c, d) Source # 
Instance details

Defined in Language.Egison.Types

Methods

toEgison :: (a, b, c, d) -> EgisonValue Source #

fromEgison :: EgisonValue -> EgisonM (a, b, c, d) Source #

Egison values

data EgisonValue Source #

newtype PolyExpr Source #

Constructors

Plus [TermExpr] 
Instances
Eq PolyExpr Source # 
Instance details

Defined in Language.Egison.Types

Show PolyExpr Source # 
Instance details

Defined in Language.Egison.Types

data TermExpr Source #

Constructors

Term Integer [(SymbolExpr, Integer)] 
Instances
Eq TermExpr Source # 
Instance details

Defined in Language.Egison.Types

Show TermExpr Source # 
Instance details

Defined in Language.Egison.Types

data Tensor a Source #

Constructors

Tensor [Integer] (Vector a) [Index EgisonValue] 
Scalar a 
Instances
Show a => Show (Tensor a) Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> Tensor a -> ShowS #

show :: Tensor a -> String #

showList :: [Tensor a] -> ShowS #

Tensor

tToList :: Tensor a -> [a] Source #

tMap :: HasTensor a => (a -> EgisonM a) -> Tensor a -> EgisonM (Tensor a) Source #

tMap2 :: HasTensor a => (a -> a -> EgisonM a) -> Tensor a -> Tensor a -> EgisonM (Tensor a) Source #

tMapN :: HasTensor a => ([a] -> EgisonM a) -> [Tensor a] -> EgisonM (Tensor a) Source #

tSum :: HasTensor a => (a -> a -> EgisonM a) -> Tensor a -> Tensor a -> EgisonM (Tensor a) Source #

tProduct :: HasTensor a => (a -> a -> EgisonM a) -> Tensor a -> Tensor a -> EgisonM (Tensor a) Source #

Scalar

Internal data

data Object Source #

Instances
Show Object Source # 
Instance details

Defined in Language.Egison.Types

Show ObjectRef Source # 
Instance details

Defined in Language.Egison.Types

type ObjectRef = IORef Object Source #

For memoization

Environment

data Env Source #

Instances
Show Env Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> Env -> ShowS #

show :: Env -> String #

showList :: [Env] -> ShowS #

data Var Source #

Constructors

Var [String] [Index ()] 
Instances
Eq Var Source # 
Instance details

Defined in Language.Egison.Types

Methods

(==) :: Var -> Var -> Bool #

(/=) :: Var -> Var -> Bool #

Show Var Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> Var -> ShowS #

show :: Var -> String #

showList :: [Var] -> ShowS #

Generic Var Source # 
Instance details

Defined in Language.Egison.Types

Associated Types

type Rep Var :: Type -> Type #

Methods

from :: Var -> Rep Var x #

to :: Rep Var x -> Var #

Hashable Var Source # 
Instance details

Defined in Language.Egison.Types

Methods

hashWithSalt :: Int -> Var -> Int #

hash :: Var -> Int #

type Rep Var Source # 
Instance details

Defined in Language.Egison.Types

type Id = String Source #

Pattern matching

data PMMode Source #

Constructors

BFSMode 
DFSMode Id 
Instances
Show PMMode Source # 
Instance details

Defined in Language.Egison.Types

makeLenses

Errors

liftError :: MonadError e m => Either e a -> m a Source #

Monads

newtype EgisonM a Source #

Constructors

EgisonM 
Instances
Monad EgisonM Source # 
Instance details

Defined in Language.Egison.Types

Methods

(>>=) :: EgisonM a -> (a -> EgisonM b) -> EgisonM b #

(>>) :: EgisonM a -> EgisonM b -> EgisonM b #

return :: a -> EgisonM a #

fail :: String -> EgisonM a #

Functor EgisonM Source # 
Instance details

Defined in Language.Egison.Types

Methods

fmap :: (a -> b) -> EgisonM a -> EgisonM b #

(<$) :: a -> EgisonM b -> EgisonM a #

MonadFail EgisonM Source # 
Instance details

Defined in Language.Egison.Types

Methods

fail :: String -> EgisonM a #

Applicative EgisonM Source # 
Instance details

Defined in Language.Egison.Types

Methods

pure :: a -> EgisonM a #

(<*>) :: EgisonM (a -> b) -> EgisonM a -> EgisonM b #

liftA2 :: (a -> b -> c) -> EgisonM a -> EgisonM b -> EgisonM c #

(*>) :: EgisonM a -> EgisonM b -> EgisonM b #

(<*) :: EgisonM a -> EgisonM b -> EgisonM a #

MonadIO EgisonM Source # 
Instance details

Defined in Language.Egison.Types

Methods

liftIO :: IO a -> EgisonM a #

MonadFresh EgisonM Source # 
Instance details

Defined in Language.Egison.Types

MonadError EgisonError EgisonM Source # 
Instance details

Defined in Language.Egison.Types

parallelMapM :: (a -> EgisonM b) -> [a] -> EgisonM [b] Source #

newtype FreshT m a Source #

Constructors

FreshT 

Fields

Instances
MonadTrans FreshT Source # 
Instance details

Defined in Language.Egison.Types

Methods

lift :: Monad m => m a -> FreshT m a #

MonadState s m => MonadState s (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

get :: FreshT m s #

put :: s -> FreshT m () #

state :: (s -> (a, s)) -> FreshT m a #

MonadError e m => MonadError e (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

throwError :: e -> FreshT m a #

catchError :: FreshT m a -> (e -> FreshT m a) -> FreshT m a #

Monad m => Monad (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

(>>=) :: FreshT m a -> (a -> FreshT m b) -> FreshT m b #

(>>) :: FreshT m a -> FreshT m b -> FreshT m b #

return :: a -> FreshT m a #

fail :: String -> FreshT m a #

Functor m => Functor (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

fmap :: (a -> b) -> FreshT m a -> FreshT m b #

(<$) :: a -> FreshT m b -> FreshT m a #

Monad m => Applicative (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

pure :: a -> FreshT m a #

(<*>) :: FreshT m (a -> b) -> FreshT m a -> FreshT m b #

liftA2 :: (a -> b -> c) -> FreshT m a -> FreshT m b -> FreshT m c #

(*>) :: FreshT m a -> FreshT m b -> FreshT m b #

(<*) :: FreshT m a -> FreshT m b -> FreshT m a #

MonadIO (FreshT IO) Source # 
Instance details

Defined in Language.Egison.Types

Methods

liftIO :: IO a -> FreshT IO a #

(Applicative m, Monad m) => MonadFresh (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Monad m => MonadState (Int, Int) (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

Methods

get :: FreshT m (Int, Int) #

put :: (Int, Int) -> FreshT m () #

state :: ((Int, Int) -> (a, (Int, Int))) -> FreshT m a #

class (Applicative m, Monad m) => MonadFresh m where Source #

Methods

fresh :: m String Source #

freshV :: m Var Source #

Instances
MonadFresh EgisonM Source # 
Instance details

Defined in Language.Egison.Types

MonadFresh DesugarM Source # 
Instance details

Defined in Language.Egison.Desugar

(Applicative m, Monad m) => MonadFresh (FreshT m) Source # 
Instance details

Defined in Language.Egison.Types

MonadFresh m => MonadFresh (ExceptT e m) Source # 
Instance details

Defined in Language.Egison.Types

MonadFresh m => MonadFresh (StateT s m) Source # 
Instance details

Defined in Language.Egison.Types

(MonadFresh m, Monoid e) => MonadFresh (WriterT e m) Source # 
Instance details

Defined in Language.Egison.Types

(MonadFresh m, Monoid e) => MonadFresh (ReaderT e m) Source # 
Instance details

Defined in Language.Egison.Types

runFreshT :: Monad m => (Int, Int) -> FreshT m a -> m (a, (Int, Int)) Source #

data MList m a Source #

Constructors

MNil 
MCons a (m (MList m a)) 
Instances
Show a => Show (MList m a) Source # 
Instance details

Defined in Language.Egison.Types

Methods

showsPrec :: Int -> MList m a -> ShowS #

show :: MList m a -> String #

showList :: [MList m a] -> ShowS #

fromList :: Monad m => [a] -> MList m a Source #

fromSeq :: Monad m => Seq a -> MList m a Source #

fromMList :: Monad m => MList m a -> m [a] Source #

msingleton :: Monad m => a -> MList m a Source #

mfoldr :: Monad m => (a -> m b -> m b) -> m b -> MList m a -> m b Source #

mappend :: Monad m => MList m a -> m (MList m a) -> m (MList m a) Source #

mconcat :: Monad m => MList m (MList m a) -> m (MList m a) Source #

mmap :: Monad m => (a -> m b) -> MList m a -> m (MList m b) Source #

mfor :: Monad m => MList m a -> (a -> m b) -> m (MList m b) Source #

Typing