Safe Haskell | None |
---|---|
Language | Haskell2010 |
Strictly typed statements of Indigo language.
Synopsis
- module Indigo.Backend.Var
- module Indigo.Backend.Scope
- module Indigo.Backend.Lambda
- module Indigo.Backend.Error
- module Indigo.Backend.Conditional
- module Indigo.Backend.Case
- forEach :: forall a e inp xs. (IterOpHs a, KnownValue (IterOpElHs a), e :~> a) => e -> (Var (IterOpElHs a) -> IndigoState (IterOpElHs a & inp) xs ()) -> IndigoState inp inp ()
- while :: forall inp xs ex. ex :~> Bool => ex -> IndigoState inp xs () -> IndigoState inp inp ()
- whileLeft :: forall inp xs ex l r. (ex :~> Either l r, KnownValue l, KnownValue r) => ex -> (Var l -> IndigoState (l & inp) xs ()) -> IndigoState inp (r & inp) (Var r)
- selfCalling :: forall p inp mname. (NiceParameterFull p, KnownValue (GetEntryPointArgCustom p mname)) => EntryPointRef mname -> IndigoState inp (ContractRef (GetEntryPointArgCustom p mname) & inp) (Var (ContractRef (GetEntryPointArgCustom p mname)))
- contractCalling :: forall cp inp epRef epArg addr exAddr. (HasEntryPointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, IsExpr exAddr addr, KnownValue epArg) => epRef -> exAddr -> IndigoState inp (Maybe (ContractRef epArg) & inp) (Var (Maybe (ContractRef epArg)))
- doc :: DocItem di => di -> IndigoState s s ()
- docGroup :: DocGrouping -> IndigoState i o () -> IndigoState i o ()
- docStorage :: forall storage s. TypeHasDoc storage => IndigoState s s ()
- contractName :: Text -> IndigoState i o () -> IndigoState i o ()
- finalizeParamCallingDoc :: forall cp param inp out x. (param :~> cp, NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> IndigoState (cp & inp) out x) -> param -> IndigoState inp out x
- contractGeneral :: IndigoState i o () -> IndigoState i o ()
- contractGeneralDefault :: IndigoState s s ()
- transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects) => exp -> exm -> exc -> IndigoState inp inp ()
- setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash)) => ex -> IndigoState inp inp ()
- scope :: forall a inp out. ScopeCodeGen a => IndigoState inp out a -> IndigoState inp (RetOutStack a ++ inp) (RetVars a)
- comment :: CommentType -> IndigoState i i ()
- fromLorentzFun1 :: (KnownValue ret, IsExpr ex a) => (:->) ((&) a s) ((&) ret s) -> ex -> IndigoState s ((&) ret s) (Var ret)
- fromLorentzFun2 :: (KnownValue ret, IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a s)) ((&) ret s) -> ex -> ex -> IndigoState s ((&) ret s) (Var ret)
- fromLorentzFun3 :: (KnownValue ret, IsExpr ex a, IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a ((&) a s))) ((&) ret s) -> ex -> ex -> ex -> IndigoState s ((&) ret s) (Var ret)
- fromLorentzFun1Void :: IsExpr ex a => (:->) ((&) a s) s -> ex -> IndigoState s s ()
- fromLorentzFun2Void :: (IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a s)) s -> ex -> ex -> IndigoState s s ()
- fromLorentzFun3Void :: (IsExpr ex a, IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a ((&) a s))) s -> ex -> ex -> ex -> IndigoState s s ()
Documentation
module Indigo.Backend.Var
module Indigo.Backend.Scope
module Indigo.Backend.Lambda
module Indigo.Backend.Error
module Indigo.Backend.Conditional
module Indigo.Backend.Case
Loop
forEach :: forall a e inp xs. (IterOpHs a, KnownValue (IterOpElHs a), e :~> a) => e -> (Var (IterOpElHs a) -> IndigoState (IterOpElHs a & inp) xs ()) -> IndigoState inp inp () Source #
For statements to iterate over container.
while :: forall inp xs ex. ex :~> Bool => ex -> IndigoState inp xs () -> IndigoState inp inp () Source #
While statement. The same rule about releasing.
whileLeft :: forall inp xs ex l r. (ex :~> Either l r, KnownValue l, KnownValue r) => ex -> (Var l -> IndigoState (l & inp) xs ()) -> IndigoState inp (r & inp) (Var r) Source #
Contract call
selfCalling :: forall p inp mname. (NiceParameterFull p, KnownValue (GetEntryPointArgCustom p mname)) => EntryPointRef mname -> IndigoState inp (ContractRef (GetEntryPointArgCustom p mname) & inp) (Var (ContractRef (GetEntryPointArgCustom p mname))) Source #
contractCalling :: forall cp inp epRef epArg addr exAddr. (HasEntryPointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, IsExpr exAddr addr, KnownValue epArg) => epRef -> exAddr -> IndigoState inp (Maybe (ContractRef epArg) & inp) (Var (Maybe (ContractRef epArg))) Source #
Documentation
doc :: DocItem di => di -> IndigoState s s () Source #
Put a document item.
docGroup :: DocGrouping -> IndigoState i o () -> IndigoState i o () Source #
Group documentation built in the given piece of code into block dedicated to one thing, e.g. to one entrypoint.
docStorage :: forall storage s. TypeHasDoc storage => IndigoState s s () Source #
Insert documentation of the contract storage type. The type should be passed using type applications.
contractName :: Text -> IndigoState i o () -> IndigoState i o () Source #
Give a name to given contract. Apply it to the whole contract code.
finalizeParamCallingDoc :: forall cp param inp out x. (param :~> cp, NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> IndigoState (cp & inp) out x) -> param -> IndigoState inp out x Source #
Indigo version for the function of the same name from Lorentz.
contractGeneral :: IndigoState i o () -> IndigoState i o () Source #
Attach general info to given contract.
contractGeneralDefault :: IndigoState s s () Source #
Attach default general info to the contract documentation.
Side-effects
transferTokens :: (IsExpr exp p, IsExpr exm Mutez, IsExpr exc (ContractRef p), NiceParameter p, HasSideEffects) => exp -> exm -> exc -> IndigoState inp inp () Source #
setDelegate :: (HasSideEffects, IsExpr ex (Maybe KeyHash)) => ex -> IndigoState inp inp () Source #
Functions, Procedures and Scopes
scope :: forall a inp out. ScopeCodeGen a => IndigoState inp out a -> IndigoState inp (RetOutStack a ++ inp) (RetVars a) Source #
Takes an arbitrary IndigoM
and wraps it into an IndigoFunction
producing a local scope for its execution. Once it executed, all
non-returned variables are cleaned up so that the stack has only
returned variables at the top. This also can be interpreted as
if True then f else nop
.
Note, that by default we do not define scope inside indigo functions,
meaning that once we want to create a new variable or return it from
a function we need to do it inside scope $ instr
construction, for
example:
f :: IndigoFunction s Natural f = scope $ do *[s]* res <- newVar (0 :: Natural) *[Natural, s]* scope $ do _n <- newVar (1 :: Integer) *[Integer, Natural, s] res += 4 *[Natural, s]* return res *[s]*
Comments
comment :: CommentType -> IndigoState i i () Source #
Add a comment
Conversion from Lorentz
fromLorentzFun1 :: (KnownValue ret, IsExpr ex a) => (:->) ((&) a s) ((&) ret s) -> ex -> IndigoState s ((&) ret s) (Var ret) Source #
fromLorentzFun2 :: (KnownValue ret, IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a s)) ((&) ret s) -> ex -> ex -> IndigoState s ((&) ret s) (Var ret) Source #
fromLorentzFun3 :: (KnownValue ret, IsExpr ex a, IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a ((&) a s))) ((&) ret s) -> ex -> ex -> ex -> IndigoState s ((&) ret s) (Var ret) Source #
fromLorentzFun1Void :: IsExpr ex a => (:->) ((&) a s) s -> ex -> IndigoState s s () Source #
fromLorentzFun2Void :: (IsExpr ex a, IsExpr ex a) => (:->) ((&) a ((&) a s)) s -> ex -> ex -> IndigoState s s () Source #