egison-3.7.2: 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 String 
FreshVarExpr 
IndexedExpr Bool EgisonExpr [Index EgisonExpr] 
SubrefsExpr EgisonExpr EgisonExpr 
SuprefsExpr EgisonExpr EgisonExpr 
UserIndexedExpr EgisonExpr [UserIndex EgisonExpr] 
PowerExpr EgisonExpr EgisonExpr 
InductiveDataExpr String [EgisonExpr] 
TupleExpr [EgisonExpr] 
CollectionExpr [InnerExpr] 
ArrayExpr [EgisonExpr] 
HashExpr [(EgisonExpr, EgisonExpr)] 
VectorExpr [EgisonExpr] 
LambdaExpr [Arg] EgisonExpr 
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 
MatcherBFSExpr MatcherInfo 
MatcherDFSExpr MatcherInfo 
AlgebraicDataMatcherExpr [(String, [EgisonExpr])] 
QuoteExpr EgisonExpr 
QuoteFunctionExpr 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 
SomethingExpr 
UndefinedExpr 

data Arg Source #

Instances

Eq Arg Source # 

Methods

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

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

Show Arg Source # 

Methods

showsPrec :: Int -> Arg -> ShowS #

show :: Arg -> String #

showList :: [Arg] -> ShowS #

class EgisonData a where Source #

Minimal complete definition

toEgison, fromEgison

Instances

EgisonData Bool Source # 
EgisonData Char Source # 
EgisonData Double Source # 
EgisonData Integer Source # 
EgisonData Rational Source # 
EgisonData () Source # 
EgisonData Handle Source # 
EgisonData Text Source # 
EgisonData a => EgisonData [a] Source # 
(EgisonData a, EgisonData b) => EgisonData (a, b) Source # 
(EgisonData a, EgisonData b, EgisonData c) => EgisonData (a, b, c) Source # 

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 # 

Methods

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

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

Egison values

data EgisonValue Source #

data Tensor a Source #

Constructors

Tensor [Integer] (Vector a) [Index EgisonValue] 
Scalar a 

Instances

Show a => Show (Tensor a) Source # 

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

type ObjectRef = IORef Object Source #

For memoization

Environment

data Env Source #

Constructors

Env [HashMap String ObjectRef] 

Instances

Show Env Source # 

Methods

showsPrec :: Int -> Env -> ShowS #

show :: Env -> String #

showList :: [Env] -> ShowS #

data Var Source #

Constructors

Var String [Index ()] 

Instances

Eq Var Source # 

Methods

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

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

Show Var Source # 

Methods

showsPrec :: Int -> Var -> ShowS #

show :: Var -> String #

showList :: [Var] -> ShowS #

Pattern matching

data PMMode Source #

Constructors

BFSMode 
DFSMode 

Instances

Errors

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

Monads

newtype EgisonM a Source #

Constructors

EgisonM 

Instances

Monad EgisonM Source # 

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 # 

Methods

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

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

Applicative EgisonM Source # 

Methods

pure :: a -> EgisonM a #

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

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

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

MonadIO EgisonM Source # 

Methods

liftIO :: IO a -> EgisonM a #

MonadFresh EgisonM Source # 
MonadError EgisonError EgisonM Source # 

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

newtype FreshT m a Source #

Constructors

FreshT 

Fields

Instances

MonadTrans FreshT Source # 

Methods

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

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

Methods

throwError :: e -> FreshT m a #

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

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

Methods

get :: FreshT m s #

put :: s -> FreshT m () #

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

Monad m => Monad (FreshT m) Source # 

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 # 

Methods

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

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

Monad m => Applicative (FreshT m) Source # 

Methods

pure :: a -> FreshT m a #

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

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

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

MonadIO (FreshT IO) Source # 

Methods

liftIO :: IO a -> FreshT IO a #

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

Methods

fresh :: FreshT m String Source #

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

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 #

Minimal complete definition

fresh

Methods

fresh :: m String Source #

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 (MList m a) Source # 

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