alga-0.1.0: Algorithmic automation for various DAWs

Safe HaskellNone
LanguageHaskell2010

Alga.Language.Environment

Synopsis

Documentation

class Monad m => HasEnv m where Source

Type class for things that can be considered MIDA environment.

Methods

getDefs :: m Defs Source

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.

Instances

runAlgaEnv :: Monad m => AlgaEnv m a -> m a Source

Run state monad with ALGA environment.

addDef Source

Arguments

:: HasEnv m 
=> String

Reference name

-> SyntaxTree

AST of its principle

-> m () 

Add a new definition to the environment.

remDef Source

Arguments

:: HasEnv m 
=> String

Reference name

-> m () 

Remove definition given its name.

clearDefs :: HasEnv m => m () Source

Remove all definitions, restoring default state of environment.

getPrin Source

Arguments

:: HasEnv m 
=> String

Reference name

-> m SyntaxTree

Syntax tree

Get principle corresponding to given variable name.

getSrc Source

Arguments

:: HasEnv m 
=> String

Reference name

-> m Text

Textual representation of source code

Get source code of definition given its name.

fullSrc :: HasEnv m => m Text Source

Reconstruct source code for all existing definitions.

getRefs :: HasEnv m => m [String] Source

Get all reference names defined at the moment.

purgeEnv Source

Arguments

:: HasEnv m 
=> [String]

Top-level definitions

-> m () 

Purge environment removing definitions that are not used in construction of “top-level” definitions.

checkRecur Source

Arguments

:: HasEnv m 
=> String

Reference name

-> SyntaxTree

Its syntax tree

-> m Bool 

Check if definition with given name is depends on itself.