indigo-0.2.0: Convenient imperative eDSL over Lorentz.
Safe HaskellNone
LanguageHaskell2010

Indigo.Frontend.Program

Synopsis

Documentation

newtype IndigoM a Source #

Monad for writing your contracts in.

Constructors

IndigoM 

Instances

Instances details
Monad IndigoM Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

(>>=) :: IndigoM a -> (a -> IndigoM b) -> IndigoM b #

(>>) :: IndigoM a -> IndigoM b -> IndigoM b #

return :: a -> IndigoM a #

Functor IndigoM Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

fmap :: (a -> b) -> IndigoM a -> IndigoM b #

(<$) :: a -> IndigoM b -> IndigoM a #

Applicative IndigoM Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

pure :: a -> IndigoM a #

(<*>) :: IndigoM (a -> b) -> IndigoM a -> IndigoM b #

liftA2 :: (a -> b -> c) -> IndigoM a -> IndigoM b -> IndigoM c #

(*>) :: IndigoM a -> IndigoM b -> IndigoM b #

(<*) :: IndigoM a -> IndigoM b -> IndigoM a #

data Program instr a where Source #

This is freer monad (in other words operational monad).

It preserves the structure of the computation performed over it, including return and bind operations. This was introduced to be able to iterate over Indigo code and optimize/analyze it.

You can read a clearer description of this construction in "The Book of Monads" by Alejandro Serrano. There is a chapter about free monads, specifically about Freer you can read at page 259. There is "operational" package which contains transformer of this monad and auxiliary functions but it's not used because we are using only some basics of it.

Constructors

Done :: a -> Program instr a 
Instr :: instr a -> Program instr a 
Bind :: Program instr a -> (a -> Program instr b) -> Program instr b 

Instances

Instances details
Monad (Program instr) Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

(>>=) :: Program instr a -> (a -> Program instr b) -> Program instr b #

(>>) :: Program instr a -> Program instr b -> Program instr b #

return :: a -> Program instr a #

Functor (Program instr) Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

fmap :: (a -> b) -> Program instr a -> Program instr b #

(<$) :: a -> Program instr b -> Program instr a #

Applicative (Program instr) Source # 
Instance details

Defined in Indigo.Frontend.Program

Methods

pure :: a -> Program instr a #

(<*>) :: Program instr (a -> b) -> Program instr a -> Program instr b #

liftA2 :: (a -> b -> c) -> Program instr a -> Program instr b -> Program instr c #

(*>) :: Program instr a -> Program instr b -> Program instr b #

(<*) :: Program instr a -> Program instr b -> Program instr a #

interpretProgram :: Monad m => (forall x. instr x -> m x) -> Program instr a -> m a Source #

Traverse over Freer structure and interpret it