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 :: (IterOpHs a, KnownValue (IterOpElHs a)) => Expr a -> (Var (IterOpElHs a) -> IndigoState (IterOpElHs a & inp) xs ()) -> IndigoState inp inp ()
- while :: Expr Bool -> IndigoState inp xs () -> IndigoState inp inp ()
- whileLeft :: (KnownValue l, KnownValue r) => Expr (Either l r) -> (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. (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, KnownValue epArg) => epRef -> Expr addr -> 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 :: (NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> IndigoState (cp & inp) out x) -> Expr cp -> IndigoState inp out x
- contractGeneral :: IndigoState i o () -> IndigoState i o ()
- contractGeneralDefault :: IndigoState s s ()
- transferTokens :: (NiceParameter p, HasSideEffects) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> IndigoState inp inp ()
- setDelegate :: HasSideEffects => Expr (Maybe KeyHash) -> 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 ()
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 :: (IterOpHs a, KnownValue (IterOpElHs a)) => Expr a -> (Var (IterOpElHs a) -> IndigoState (IterOpElHs a & inp) xs ()) -> IndigoState inp inp () Source #
For statements to iterate over container.
while :: Expr Bool -> IndigoState inp xs () -> IndigoState inp inp () Source #
While statement. The same rule about releasing.
whileLeft :: (KnownValue l, KnownValue r) => Expr (Either l r) -> (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. (HasEntrypointArg cp epRef epArg, ToTAddress cp addr, ToT addr ~ ToT Address, KnownValue epArg) => epRef -> Expr addr -> 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 :: (NiceParameterFull cp, RequireSumType cp, HasCallStack) => (Var cp -> IndigoState (cp & inp) out x) -> Expr cp -> 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 :: (NiceParameter p, HasSideEffects) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> IndigoState inp inp () Source #
setDelegate :: HasSideEffects => Expr (Maybe KeyHash) -> 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