indigo-0.6.0: Convenient imperative eDSL over Lorentz.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Indigo.Compilation.Sequential.Types

Contents

Description

Instruction datatype.

Synopsis

Documentation

type Block = [Instruction] Source #

Simple synonym for a list of Instruction

data Instruction where Source #

Data type representing an instruction.

Differently from the frontend this is not used to build a Monad of some kind, it is instead based on having as argument the variable to associate with the resulting value (if any).

This is combined in simple lists, named Block, and it is intended to be easily altered, this is because these are used as the intermediate representation between the frontend and the backend, where optimizations can occur.

Constructors

LiftIndigoState :: (forall inp. SomeIndigoState inp) -> Instruction 
Comment :: Text -> Instruction 
AssignVar :: KnownValue x => Var x -> Expr x -> Instruction 
SetVar :: KnownValue x => Var x -> Expr x -> Instruction 
VarModification :: (IsObject x, KnownValue y) => ([y, x] :-> '[x]) -> Var x -> Expr y -> Instruction 
SetField :: (HasField store fname ftype, IsObject store, IsObject ftype) => Var store -> Label fname -> Expr ftype -> Instruction 
LambdaCall1 

Fields

  • :: LambdaKind st arg ret extra

    Kind of lambda (pure, storage modification, fully functional lambda with effects)

  • -> String

    Name of the lambda

  • -> Expr arg

    Expression for the lambda argument

  • -> Var arg

    Variable for the argument value (available to the lambda code block)

  • -> Block

    Code block for the lambda

  • -> ret

    Return value(s) of the lambda

  • -> RetVars ret

    Variable(s) that will be assigned to the resulting value(s)

  • -> Instruction
     
CreateLambda1 

Fields

ExecLambda1 

Fields

Scope 

Fields

  • :: ScopeCodeGen ret
     
  • => Block

    Code block to execute inside the scope

  • -> ret

    Return value(s) of the scoped code block

  • -> RetVars ret

    Variable that will be assigned to the resulting value(s)

  • -> Instruction
     
If 

Fields

  • :: IfConstraint a b
     
  • => Expr Bool

    Expression for the control flow

  • -> Block

    Code block for the positive branch

  • -> a

    Return value(s) of the positive branch

  • -> Block

    Code block for the negative branch

  • -> b

    Return value(s) of the negative branch

  • -> RetVars a

    Variable(s) that will be assigned to the resulting value(s)

  • -> Instruction
     
IfSome 

Fields

IfRight 

Fields

IfCons 

Fields

  • :: (IfConstraint a b, KnownValue x)
     
  • => Expr (List x)

    Expression for the control flow

  • -> Var x

    Variable for the "head" value (available to the next code block)

  • -> Var (List x)

    Variable for the "tail" value (available to the next code block)

  • -> Block

    Code block for the non-empty list branch

  • -> a

    Return value(s) of the non-empty list branch

  • -> Block

    Code block for the empty list branch

  • -> b

    Return value(s) of the empty list branch

  • -> RetVars a

    Variable(s) that will be assigned to the resulting value(s)

  • -> Instruction
     
Case 

Fields

  • :: CaseCommon dt ret clauses
     
  • => Expr dt
     
  • -> clauses
     
  • -> RetVars ret

    Variable(s) that will be assigned to the resulting value(s)

  • -> Instruction
     
EntryCase 

Fields

EntryCaseSimple 

Fields

While 

Fields

WhileLeft 

Fields

ForEach 

Fields

ContractName :: Text -> Block -> Instruction 
DocGroup :: forall di. DocItem di => (SubDoc -> di) -> Block -> Instruction 
ContractGeneral :: Block -> Instruction 
FinalizeParamCallingDoc :: (NiceParameterFull cp, RequireSumType cp) => Var cp -> Block -> Expr cp -> Instruction 
TransferTokens :: (NiceParameter p, HasSideEffects, IsNotInView) => Expr p -> Expr Mutez -> Expr (ContractRef p) -> Instruction 
SetDelegate :: (HasSideEffects, IsNotInView) => Expr (Maybe KeyHash) -> Instruction 
CreateContract 

Fields

SelfCalling 

Fields

ContractCalling 

Fields

Emit :: (HasSideEffects, NicePackedValue a, HasAnnotation a) => FieldAnn -> Expr a -> Instruction 
Fail :: (forall inp. SomeIndigoState inp) -> Instruction 
FailOver :: (forall inp. Expr a -> SomeIndigoState inp) -> Expr a -> Instruction 

data IndigoSeqCaseClause ret (param :: CaseClauseParam) where Source #

Analogous datatype as IndigoCaseClauseL and IndigoMCaseClauseL.

Constructors

OneFieldIndigoSeqCaseClause :: AppendSymbol "c" ctor ~ name => Label name -> CaseBranch x ret -> IndigoSeqCaseClause ret ('CaseClauseParam ctor ('OneField x)) 

data CaseBranch x ret where Source #

Representation of a branch of a generic case-like Instruction.

Constructors

CaseBranch 

Fields

Translations

data InstrCollector Source #

Data type internally used to collect Instructions from IndigoM