-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Language for algorithmic generation of MIDI files -- -- MIDA is a minimalistic language for algorithmic generation of MIDI -- files. MIDA is not interactive in sense that you cannot control result -- of its activity in real time, it is intended for producers and should -- be used with a DAW. MIDA can help you create variative elements in -- your music in a very simple way. Since MIDI can control a lot of -- different instruments, power of MIDA is truly great. Main reason for -- MIDA development is to create software tool that can be used in such a -- way that does not change established workflow, so people could use -- familiar plugins and software instruments. The core concept of MIDA is -- building systems with complex behaviors from very basic and -- easy-to-understand elements and powerful means of their composition. -- Currently MIDA can be used to translate source files into .mid files, -- and also in interactive mode that will help you to understand how MIDA -- language works. See MIDA Manual for more information. @package mida @version 1.0.1 module Mida.Language.Element -- | Collection of elements for evaluation, representation of some aspect -- of voice. type Principle = [Element Natural] -- | Fundamental type representing an atom for evaluation. data Element a -- | Single value, evaluates to itself Val :: a -> Element a -- | Universal container for other values Sec :: [Element a] -> Element a -- | Multivalue, the way to introduce varying elements Mul :: [Element a] -> Element a -- | Conditional multivalue CMul :: [([Element a], [Element a])] -> Element a instance Data.Foldable.Foldable Mida.Language.Element.Element instance GHC.Base.Functor Mida.Language.Element.Element instance GHC.Show.Show a => GHC.Show.Show (Mida.Language.Element.Element a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Mida.Language.Element.Element a) instance GHC.Base.Applicative Mida.Language.Element.Element module Mida.Language.SyntaxTree -- | Syntax tree in our case is just a collection of syntactic elements. type SyntaxTree = [Sel] -- | Syntactic element corresponds to language features. Some of them have -- direct corresponding constructor in Element, others have to be -- simplified first. data Sel -- | Literal value Value :: Natural -> Sel -- | Section Section :: [Sel] -> Sel -- | Multivalue Multi :: [Sel] -> Sel -- | Conditional multivalue CMulti :: [([Sel], [Sel])] -> Sel -- | Reference (name of variable) Reference :: String -> Sel -- | Range of values Range :: Natural -> Natural -> Sel -- | Product of principles Product :: Sel -> Sel -> Sel -- | Division of principles Division :: Sel -> Sel -> Sel -- | Sum of principles Sum :: Sel -> Sel -> Sel -- | Subtraction of principles Diff :: Sel -> Sel -> Sel -- | Loop Loop :: Sel -> Sel -> Sel -- | Rotation Rotation :: Sel -> Sel -> Sel -- | Reversed principle Reverse :: Sel -> Sel instance GHC.Show.Show Mida.Language.SyntaxTree.Sel instance GHC.Classes.Eq Mida.Language.SyntaxTree.Sel module Mida.Representation.Parser -- | Statement can be either definition or exposition. Expositions are only -- used in REPL. data Statement Definition :: String -> SyntaxTree -> Statement Exposition :: SyntaxTree -> Statement -- | Test if given fragment of MIDA code is finished and self-contained. probeMida :: Text -> Bool -- | Entry point for MIDA parsing. parseMida :: String -> Text -> Either String [Statement] instance GHC.Show.Show Mida.Representation.Parser.Statement instance GHC.Classes.Eq Mida.Representation.Parser.Statement module Mida.Representation.Show -- | Render a statement. This handles definitions and expositions. showStatement :: Statement -> Text -- | Render definition. showDefinition :: String -> SyntaxTree -> Text -- | Render syntax tree. showSyntaxTree :: SyntaxTree -> Text -- | Show principle. This is useful for printing of simplified principles -- back to user. We can use the same pretty-printing algorithm as for -- syntax trees, but this requires us to perform transformation from -- Principle to SyntaxTree, which is trivial. showPrinciple :: Principle -> Text module Mida.Language.Environment -- | Monad that implements MIDA environment. data MidaEnv m a -- | Type class for things that can be considered MIDA environment. class Monad m => HasEnv m -- | Get collection of all definitions. getDefs :: HasEnv m => m Defs -- | Update definitions with given ones. setDefs :: HasEnv m => Defs -> m () -- | Set random generator seed. setRandGen :: HasEnv m => Natural -> m () -- | Split current random generator, update it, and return new one. newRandGen :: HasEnv m => m TFGen -- | Run state monad with MIDA environment. runMidaEnv :: Monad m => MidaEnv m a -> m a -- | Add a new definition to the environment. addDef :: HasEnv m => String -> SyntaxTree -> m () -- | Remove definition given its name. remDef :: HasEnv m => String -> m () -- | Remove all definitions, restoring default state of environment. clearDefs :: HasEnv m => m () -- | Get principle corresponding to given variable name. getPrin :: HasEnv m => String -> m SyntaxTree -- | Get source code of definition given its name. getSrc :: HasEnv m => String -> m Text -- | Reconstruct source code for all existing definitions. fullSrc :: HasEnv m => m Text -- | Get all reference names defined at the moment. getRefs :: HasEnv m => m [String] -- | Purge environment removing definitions that are not used in -- construction of “top-level” definitions. purgeEnv :: HasEnv m => [String] -> m () -- | Check if definition with given name is depends on itself. checkRecur :: HasEnv m => String -> SyntaxTree -> m Bool instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (Mida.Language.Environment.MidaEnv m) instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Mida.Language.Environment.MidaEnv m) instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Mida.Language.Environment.MidaEnv m) instance System.Console.Haskeline.MonadException.MonadException m => System.Console.Haskeline.MonadException.MonadException (Mida.Language.Environment.MidaEnv m) instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState Mida.Language.Environment.MidaEnvSt (Mida.Language.Environment.MidaEnv m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Mida.Language.Environment.MidaEnv m) instance GHC.Base.Monad m => GHC.Base.Monad (Mida.Language.Environment.MidaEnv m) instance GHC.Base.Monad m => GHC.Base.Applicative (Mida.Language.Environment.MidaEnv m) instance GHC.Base.Functor m => GHC.Base.Functor (Mida.Language.Environment.MidaEnv m) instance GHC.Show.Show Mida.Language.Environment.MidaEnvSt instance GHC.Base.Monad m => Mida.Language.Environment.HasEnv (Mida.Language.Environment.MidaEnv m) instance Mida.Language.Environment.HasEnv m => Mida.Language.Environment.HasEnv (Control.Monad.Trans.State.Strict.StateT e m) instance Mida.Language.Environment.HasEnv m => Mida.Language.Environment.HasEnv (Control.Monad.Trans.Reader.ReaderT e m) module Mida.Language.Eval -- | Evaluate definition given its name. evalDef :: HasEnv m => String -> m [Natural] -- | Evaluate given syntax tree. eval :: HasEnv m => SyntaxTree -> m [Natural] -- | Transform SyntaxTree into Principle applying all -- necessary transformations and resolving references. toPrin :: HasEnv m => SyntaxTree -> m Principle instance GHC.Show.Show Mida.Language.Eval.CalcSt module Mida.Representation -- | Statement can be either definition or exposition. Expositions are only -- used in REPL. data Statement Definition :: String -> SyntaxTree -> Statement Exposition :: SyntaxTree -> Statement -- | Test if given fragment of MIDA code is finished and self-contained. probeMida :: Text -> Bool -- | Entry point for MIDA parsing. parseMida :: String -> Text -> Either String [Statement] -- | Render a statement. This handles definitions and expositions. showStatement :: Statement -> Text -- | Render syntax tree. showSyntaxTree :: SyntaxTree -> Text -- | Show principle. This is useful for printing of simplified principles -- back to user. We can use the same pretty-printing algorithm as for -- syntax trees, but this requires us to perform transformation from -- Principle to SyntaxTree, which is trivial. showPrinciple :: Principle -> Text module Mida.Language -- | Syntax tree in our case is just a collection of syntactic elements. type SyntaxTree = [Sel] -- | Syntactic element corresponds to language features. Some of them have -- direct corresponding constructor in Element, others have to be -- simplified first. data Sel -- | Literal value Value :: Natural -> Sel -- | Section Section :: [Sel] -> Sel -- | Multivalue Multi :: [Sel] -> Sel -- | Conditional multivalue CMulti :: [([Sel], [Sel])] -> Sel -- | Reference (name of variable) Reference :: String -> Sel -- | Range of values Range :: Natural -> Natural -> Sel -- | Product of principles Product :: Sel -> Sel -> Sel -- | Division of principles Division :: Sel -> Sel -> Sel -- | Sum of principles Sum :: Sel -> Sel -> Sel -- | Subtraction of principles Diff :: Sel -> Sel -> Sel -- | Loop Loop :: Sel -> Sel -> Sel -- | Rotation Rotation :: Sel -> Sel -> Sel -- | Reversed principle Reverse :: Sel -> Sel -- | Collection of elements for evaluation, representation of some aspect -- of voice. type Principle = [Element Natural] -- | Fundamental type representing an atom for evaluation. data Element a -- | Single value, evaluates to itself Val :: a -> Element a -- | Universal container for other values Sec :: [Element a] -> Element a -- | Multivalue, the way to introduce varying elements Mul :: [Element a] -> Element a -- | Conditional multivalue CMul :: [([Element a], [Element a])] -> Element a -- | Monad that implements MIDA environment. data MidaEnv m a -- | Type class for things that can be considered MIDA environment. class Monad m => HasEnv m -- | Get collection of all definitions. getDefs :: HasEnv m => m Defs -- | Update definitions with given ones. setDefs :: HasEnv m => Defs -> m () -- | Set random generator seed. setRandGen :: HasEnv m => Natural -> m () -- | Split current random generator, update it, and return new one. newRandGen :: HasEnv m => m TFGen -- | Run state monad with MIDA environment. runMidaEnv :: Monad m => MidaEnv m a -> m a -- | Add a new definition to the environment. addDef :: HasEnv m => String -> SyntaxTree -> m () -- | Remove definition given its name. remDef :: HasEnv m => String -> m () -- | Remove all definitions, restoring default state of environment. clearDefs :: HasEnv m => m () -- | Get principle corresponding to given variable name. getPrin :: HasEnv m => String -> m SyntaxTree -- | Get source code of definition given its name. getSrc :: HasEnv m => String -> m Text -- | Reconstruct source code for all existing definitions. fullSrc :: HasEnv m => m Text -- | Get all reference names defined at the moment. getRefs :: HasEnv m => m [String] -- | Purge environment removing definitions that are not used in -- construction of “top-level” definitions. purgeEnv :: HasEnv m => [String] -> m () -- | Check if definition with given name is depends on itself. checkRecur :: HasEnv m => String -> SyntaxTree -> m Bool -- | Evaluate definition given its name. evalDef :: HasEnv m => String -> m [Natural] -- | Evaluate given syntax tree. eval :: HasEnv m => SyntaxTree -> m [Natural] -- | Transform SyntaxTree into Principle applying all -- necessary transformations and resolving references. toPrin :: HasEnv m => SyntaxTree -> m Principle module Mida.Midi -- | Generate MIDI file from MIDA environment. genMidi :: HasEnv m => Natural -> Natural -> Natural -> m Midi -- | Collection of “top-level” definitions. topDefs :: [String] instance GHC.Enum.Enum Mida.Midi.Figure instance GHC.Enum.Bounded Mida.Midi.Figure instance GHC.Show.Show Mida.Midi.Figure instance GHC.Classes.Eq Mida.Midi.Figure