Copyright | Satoshi Egi |
---|---|
License | MIT |
Safe Haskell | None |
Language | Haskell98 |
This module contains type definitions of Egison Data.
- data EgisonTopExpr
- data EgisonExpr
- = CharExpr Char
- | StringExpr String
- | BoolExpr Bool
- | RationalExpr Rational
- | IntegerExpr Integer
- | FloatExpr Double
- | VarExpr String
- | IndexedExpr EgisonExpr [EgisonExpr]
- | InductiveDataExpr String [EgisonExpr]
- | TupleExpr [EgisonExpr]
- | CollectionExpr (Seq InnerExpr)
- | ArrayExpr [EgisonExpr]
- | HashExpr [(EgisonExpr, EgisonExpr)]
- | LambdaExpr [String] EgisonExpr
- | PatternFunctionExpr [String] EgisonPattern
- | IfExpr EgisonExpr EgisonExpr EgisonExpr
- | LetExpr [BindingExpr] EgisonExpr
- | LetRecExpr [BindingExpr] EgisonExpr
- | MatchExpr EgisonExpr EgisonExpr [MatchClause]
- | MatchAllExpr EgisonExpr EgisonExpr MatchClause
- | MatchLambdaExpr EgisonExpr [MatchClause]
- | MatcherExpr MatcherInfo
- | DoExpr [BindingExpr] EgisonExpr
- | IoExpr EgisonExpr
- | ApplyExpr EgisonExpr EgisonExpr
- | AlgebraicDataMatcherExpr [(String, [EgisonExpr])]
- | GenerateArrayExpr [String] EgisonExpr EgisonExpr
- | ArraySizeExpr EgisonExpr
- | ArrayRefExpr EgisonExpr EgisonExpr
- | ValueExpr EgisonValue
- | SomethingExpr
- | UndefinedExpr
- data EgisonPattern
- = WildCard
- | PatVar String
- | VarPat String
- | ValuePat EgisonExpr
- | PredPat EgisonExpr
- | IndexedPat EgisonPattern [EgisonExpr]
- | LetPat [BindingExpr] EgisonPattern
- | NotPat EgisonPattern
- | AndPat [EgisonPattern]
- | OrPat [EgisonPattern]
- | TuplePat [EgisonPattern]
- | InductivePat String [EgisonPattern]
- | ApplyPat EgisonExpr [EgisonPattern]
- | LoopPat String LoopRange EgisonPattern EgisonPattern
- | ContPat
- data InnerExpr
- type BindingExpr = ([String], EgisonExpr)
- type MatchClause = (EgisonPattern, EgisonExpr)
- type MatcherInfo = [(PrimitivePatPattern, EgisonExpr, [(PrimitiveDataPattern, EgisonExpr)])]
- data LoopRange
- data PrimitivePatPattern
- data PrimitiveDataPattern
- data EgisonValue
- = World
- | Char Char
- | Bool Bool
- | Rational Rational
- | Integer Integer
- | Float Double
- | InductiveData String [EgisonValue]
- | Tuple [EgisonValue]
- | Collection (Seq EgisonValue)
- | Array (IntMap EgisonValue)
- | IntHash (HashMap Integer EgisonValue)
- | StrHash (HashMap ByteString EgisonValue)
- | Matcher Matcher
- | Func Env [String] EgisonExpr
- | PatternFunc Env [String] EgisonPattern
- | PrimitiveFunc PrimitiveFunc
- | IOFunc (EgisonM WHNFData)
- | Port Handle
- | Something
- | Undefined
- | EOF
- type Matcher = (Env, MatcherInfo)
- type PrimitiveFunc = WHNFData -> EgisonM WHNFData
- class Egison a where
- toEgison :: a -> EgisonValue
- fromEgison :: EgisonValue -> EgisonM a
- fromMatcherValue :: EgisonValue -> Either EgisonError Matcher
- data Object
- type ObjectRef = IORef Object
- data WHNFData
- data Intermediate
- data Inner
- class EgisonWHNF a where
- type Env = [HashMap Var ObjectRef]
- type Var = String
- type Binding = (Var, ObjectRef)
- nullEnv :: Env
- extendEnv :: Env -> [Binding] -> Env
- refVar :: Env -> Var -> EgisonM ObjectRef
- data PMMode
- data MatchingState = MState Env [LoopContext] [Binding] [MatchingTree]
- data MatchingTree
- type PatternBinding = (Var, EgisonPattern)
- data LoopContext
- data EgisonError
- liftError :: MonadError e m => Either e a -> m a
- newtype EgisonM a = EgisonM {
- unEgisonM :: ErrorT EgisonError (FreshT IO) a
- runEgisonM :: EgisonM a -> FreshT IO (Either EgisonError a)
- liftEgisonM :: Fresh (Either EgisonError a) -> EgisonM a
- fromEgisonM :: EgisonM a -> IO (Either EgisonError a)
- newtype FreshT m a = FreshT {}
- type Fresh = FreshT Identity
- class (Applicative m, Monad m) => MonadFresh m where
- runFreshT :: Monad m => Int -> FreshT m a -> m (a, Int)
- type MatchM = MaybeT EgisonM
- matchFail :: MatchM a
- data MList m a
- fromList :: Monad m => [a] -> MList m a
- fromSeq :: Monad m => Seq a -> MList m a
- fromMList :: Monad m => MList m a -> m [a]
- msingleton :: Monad m => a -> MList m a
- mfoldr :: Monad m => (a -> m b -> m b) -> m b -> MList m a -> m b
- mappend :: Monad m => MList m a -> m (MList m a) -> m (MList m a)
- mconcat :: Monad m => MList m (MList m a) -> m (MList m a)
- mmap :: Monad m => (a -> m b) -> MList m a -> m (MList m b)
- mfor :: Monad m => MList m a -> (a -> m b) -> m (MList m b)
Egison expressions
data EgisonTopExpr Source
data EgisonExpr Source
data EgisonPattern Source
type BindingExpr = ([String], EgisonExpr) Source
type MatchClause = (EgisonPattern, EgisonExpr) Source
type MatcherInfo = [(PrimitivePatPattern, EgisonExpr, [(PrimitiveDataPattern, EgisonExpr)])] Source
Egison values
data EgisonValue Source
type Matcher = (Env, MatcherInfo) Source
type PrimitiveFunc = WHNFData -> EgisonM WHNFData Source
toEgison :: a -> EgisonValue Source
fromEgison :: EgisonValue -> EgisonM a Source
Internal data
data Intermediate Source
class EgisonWHNF a where Source
Environment
Pattern matching
data MatchingState Source
MState Env [LoopContext] [Binding] [MatchingTree] |
type PatternBinding = (Var, EgisonPattern) Source
data LoopContext Source
Errors
data EgisonError Source
liftError :: MonadError e m => Either e a -> m a Source
Monads
runEgisonM :: EgisonM a -> FreshT IO (Either EgisonError a) Source
liftEgisonM :: Fresh (Either EgisonError a) -> EgisonM a Source
fromEgisonM :: EgisonM a -> IO (Either EgisonError a) Source
MonadTrans FreshT | |
MonadError e m => MonadError e (FreshT m) | |
Monad m => MonadState Int (FreshT m) | |
MonadState s m => MonadState s (FreshT m) | |
Monad m => Monad (FreshT m) | |
Functor m => Functor (FreshT m) | |
(Monad m, Functor m) => Applicative (FreshT m) | |
MonadIO (FreshT IO) | |
(Applicative m, Monad m) => MonadFresh (FreshT m) |
class (Applicative m, Monad m) => MonadFresh m where Source
MonadFresh EgisonM | |
MonadFresh DesugarM | |
(Applicative m, Monad m) => MonadFresh (FreshT m) | |
(MonadFresh m, Monoid e) => MonadFresh (ReaderT e m) | |
(MonadFresh m, Error e) => MonadFresh (ErrorT e m) | |
MonadFresh m => MonadFresh (StateT s m) | |
(MonadFresh m, Monoid e) => MonadFresh (WriterT e m) |
msingleton :: Monad m => a -> MList m a Source