| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mida.Language
- type SyntaxTree = [Sel]
- data Sel
- type Principle = [Element Natural]
- data Element a
- data MidaEnv m a
- class Monad m => HasEnv m where
- getDefs :: m Defs
- setDefs :: Defs -> m ()
- setRandGen :: Natural -> m ()
- newRandGen :: m TFGen
- runMidaEnv :: Monad m => MidaEnv m a -> m a
- addDef :: HasEnv m => String -> SyntaxTree -> m ()
- remDef :: HasEnv m => String -> m ()
- clearDefs :: HasEnv m => m ()
- getPrin :: HasEnv m => String -> m SyntaxTree
- getSrc :: HasEnv m => String -> m Text
- fullSrc :: HasEnv m => m Text
- getRefs :: HasEnv m => m [String]
- purgeEnv :: HasEnv m => [String] -> m ()
- checkRecur :: HasEnv m => String -> SyntaxTree -> m Bool
- evalDef :: HasEnv m => String -> m [Natural]
- eval :: HasEnv m => SyntaxTree -> m [Natural]
- toPrin :: HasEnv m => SyntaxTree -> m Principle
Documentation
type SyntaxTree = [Sel] Source
Syntax tree in our case is just a collection of syntactic elements.
Syntactic element corresponds to language features. Some of them have
direct corresponding constructor in Element,
others have to be simplified first.
Constructors
| Value Natural | Literal value |
| Section [Sel] | Section |
| Multi [Sel] | Multivalue |
| CMulti [([Sel], [Sel])] | Conditional multivalue |
| Reference String | Reference (name of variable) |
| Range Natural Natural | Range of values |
| Product Sel Sel | Product of principles |
| Division Sel Sel | Division of principles |
| Sum Sel Sel | Sum of principles |
| Diff Sel Sel | Subtraction of principles |
| Loop Sel Sel | Loop |
| Rotation Sel Sel | Rotation |
| Reverse Sel | Reversed principle |
type Principle = [Element Natural] Source
Collection of elements for evaluation, representation of some aspect of voice.
Fundamental type representing an atom for evaluation.
Monad that implements MIDA environment.
Instances
| Monad m => Monad (MidaEnv m) Source | |
| Functor m => Functor (MidaEnv m) Source | |
| Monad m => Applicative (MidaEnv m) Source | |
| MonadThrow m => MonadThrow (MidaEnv m) Source | |
| MonadCatch m => MonadCatch (MidaEnv m) Source | |
| MonadMask m => MonadMask (MidaEnv m) Source | |
| MonadIO m => MonadIO (MidaEnv m) Source | |
| MonadException m => MonadException (MidaEnv m) Source | |
| Monad m => HasEnv (MidaEnv m) Source |
class Monad m => HasEnv m where Source
Type class for things that can be considered MIDA environment.
Methods
Get collection of all definitions.
setDefs :: Defs -> m () Source
Update definitions with given ones.
setRandGen :: Natural -> m () Source
Set random generator seed.
newRandGen :: m TFGen Source
Split current random generator, update it, and return new one.
runMidaEnv :: Monad m => MidaEnv m a -> m a Source
Run state monad with MIDA environment.
Arguments
| :: HasEnv m | |
| => String | Reference name |
| -> SyntaxTree | AST of its principle |
| -> m () |
Add a new definition to the environment.
Arguments
| :: HasEnv m | |
| => String | Reference name |
| -> m SyntaxTree | Syntax tree |
Get principle corresponding to given variable name.
Get source code of definition given its name.
Purge environment removing definitions that are not used in construction of “top-level” definitions.
Arguments
| :: HasEnv m | |
| => String | Reference name |
| -> SyntaxTree | Its syntax tree |
| -> m Bool |
Check if definition with given name is depends on itself.
Evaluate definition given its name.
Arguments
| :: HasEnv m | |
| => SyntaxTree | Syntax tree |
| -> m [Natural] | Infinite stream of naturals or empty list |
Evaluate given syntax tree.
Arguments
| :: HasEnv m | |
| => SyntaxTree | Syntax tree to transform |
| -> m Principle | Resulting principle |
Transform SyntaxTree into Principle applying all necessary
transformations and resolving references.