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 Text
- | BoolExpr Bool
- | NumberExpr (Integer, Integer) (Integer, Integer)
- | FloatExpr Double Double
- | VarExpr String
- | IndexedExpr EgisonExpr [EgisonExpr]
- | InductiveDataExpr String [EgisonExpr]
- | TupleExpr [EgisonExpr]
- | CollectionExpr [InnerExpr]
- | ArrayExpr [EgisonExpr]
- | HashExpr [(EgisonExpr, EgisonExpr)]
- | LambdaExpr [String] EgisonExpr
- | MemoizedLambdaExpr [String] EgisonExpr
- | MemoizeExpr [(EgisonExpr, EgisonExpr, EgisonExpr)] EgisonExpr
- | PatternFunctionExpr [String] EgisonPattern
- | IfExpr EgisonExpr EgisonExpr EgisonExpr
- | LetRecExpr [BindingExpr] EgisonExpr
- | LetExpr [BindingExpr] EgisonExpr
- | LetStarExpr [BindingExpr] 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
- | DoExpr [BindingExpr] EgisonExpr
- | IoExpr EgisonExpr
- | SeqExpr EgisonExpr EgisonExpr
- | ContExpr
- | ApplyExpr EgisonExpr EgisonExpr
- | PartialExpr Integer EgisonExpr
- | PartialVarExpr Integer
- | RecVarExpr
- | AlgebraicDataMatcherExpr [(String, [EgisonExpr])]
- | GenerateArrayExpr [String] EgisonExpr EgisonExpr
- | ArraySizeExpr EgisonExpr
- | ArrayRefExpr EgisonExpr EgisonExpr
- | SomethingExpr
- | UndefinedExpr
- data EgisonPattern
- = WildCard
- | PatVar String
- | ValuePat EgisonExpr
- | RegexPat EgisonExpr
- | PredPat EgisonExpr
- | IndexedPat EgisonPattern [EgisonExpr]
- | LetPat [BindingExpr] EgisonPattern
- | NotPat EgisonPattern
- | AndPat [EgisonPattern]
- | OrPat [EgisonPattern]
- | OrderedOrPat [EgisonPattern]
- | TuplePat [EgisonPattern]
- | InductivePat String [EgisonPattern]
- | LoopPat String LoopRange EgisonPattern EgisonPattern
- | ContPat
- | ApplyPat EgisonExpr [EgisonPattern]
- | VarPat String
- data InnerExpr
- type BindingExpr = ([String], EgisonExpr)
- type MatchClause = (EgisonPattern, EgisonExpr)
- type MatcherInfo = [(PrimitivePatPattern, EgisonExpr, [(PrimitiveDataPattern, EgisonExpr)])]
- data LoopRange = LoopRange EgisonExpr EgisonExpr EgisonPattern
- data PrimitivePatPattern
- data PrimitiveDataPattern
- data EgisonValue
- = World
- | Char Char
- | String Text
- | Bool Bool
- | Number (Integer, Integer) (Integer, Integer)
- | Float Double Double
- | InductiveData String [EgisonValue]
- | Tuple [EgisonValue]
- | Collection (Seq EgisonValue)
- | Array (Array Integer EgisonValue)
- | IntHash (HashMap Integer EgisonValue)
- | CharHash (HashMap Char EgisonValue)
- | StrHash (HashMap Text EgisonValue)
- | UserMatcher Env PMMode MatcherInfo
- | Func Env [String] EgisonExpr
- | MemoizedFunc ObjectRef (IORef (HashMap [Integer] ObjectRef)) Env [String] EgisonExpr
- | PatternFunc Env [String] EgisonPattern
- | PrimitiveFunc PrimitiveFunc
- | IOFunc (EgisonM WHNFData)
- | Port Handle
- | Something
- | Undefined
- | EOF
- type Matcher = EgisonValue
- type PrimitiveFunc = WHNFData -> EgisonM WHNFData
- class EgisonData a where
- toEgison :: a -> EgisonValue
- fromEgison :: EgisonValue -> EgisonM a
- showTSV :: EgisonValue -> String
- addInteger :: EgisonValue -> EgisonValue -> EgisonValue
- subInteger :: EgisonValue -> EgisonValue -> EgisonValue
- mulInteger :: EgisonValue -> EgisonValue -> EgisonValue
- addInteger' :: (Integer, Integer) -> (Integer, Integer) -> (Integer, Integer)
- subInteger' :: (Integer, Integer) -> (Integer, Integer) -> (Integer, Integer)
- mulInteger' :: (Integer, Integer) -> (Integer, Integer) -> (Integer, Integer)
- reduceFraction :: EgisonValue -> EgisonValue
- data Object
- type ObjectRef = IORef Object
- data WHNFData
- data Intermediate
- data Inner
- class EgisonData a => 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
- type Match = [Binding]
- data PMMode
- pmMode :: Matcher -> PMMode
- data MatchingState = MState Env [LoopPatContext] [Binding] [MatchingTree]
- data MatchingTree
- type PatternBinding = (Var, EgisonPattern)
- data LoopPatContext = LoopPatContext Binding ObjectRef EgisonPattern EgisonPattern EgisonPattern
- 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 = EgisonValue Source
type PrimitiveFunc = WHNFData -> EgisonM WHNFData Source
class EgisonData a where Source
toEgison :: a -> EgisonValue Source
fromEgison :: EgisonValue -> EgisonM a Source
EgisonData Bool | |
EgisonData Char | |
EgisonData Double | |
EgisonData Integer | |
EgisonData Rational | |
EgisonData () | |
EgisonData Handle | |
EgisonData Text | |
EgisonData a => EgisonData [a] | |
(EgisonData a, EgisonData b) => EgisonData (a, b) | |
(EgisonData a, EgisonData b, EgisonData c) => EgisonData (a, b, c) | |
(EgisonData a, EgisonData b, EgisonData c, EgisonData d) => EgisonData (a, b, c, d) |
showTSV :: EgisonValue -> String Source
addInteger :: EgisonValue -> EgisonValue -> EgisonValue Source
subInteger :: EgisonValue -> EgisonValue -> EgisonValue Source
mulInteger :: EgisonValue -> EgisonValue -> EgisonValue Source
Internal data
data Intermediate Source
class EgisonData a => EgisonWHNF a where Source
Environment
Pattern matching
data MatchingTree Source
type PatternBinding = (Var, EgisonPattern) Source
data LoopPatContext 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