Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype IndigoM a = IndigoM {
- unIndigoM :: Program (StatementF IndigoM) a
- data Program instr a where
- interpretProgram :: Monad m => (forall x. instr x -> m x) -> Program instr a -> m a
- type IndigoContract param st = (HasStorage st, HasSideEffects) => Var param -> IndigoM ()
Documentation
Monad for writing your contracts in.
IndigoM | |
|
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.
Done :: a -> Program instr a | |
Instr :: instr a -> Program instr a | |
Bind :: Program instr a -> (a -> Program instr b) -> Program instr b |
Instances
Monad (Program instr) Source # | |
Functor (Program instr) Source # | |
Applicative (Program instr) Source # | |
Defined in Indigo.Frontend.Program 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
type IndigoContract param st = (HasStorage st, HasSideEffects) => Var param -> IndigoM () Source #
Type of a contract that can be compiled to Lorentz with compileIndigoContract
.