Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Module, containing top-level entries of a Michelson contract.
Synopsis
- type ContractInp1 param st = 'TPair param st
- type ContractInp param st = '[ContractInp1 param st]
- type ContractOut1 st = 'TPair ('TList 'TOperation) st
- type ContractOut st = '[ContractOut1 st]
- newtype ContractCode' instr cp st = ContractCode {
- unContractCode :: instr (ContractInp cp st) (ContractOut st)
- mkContractCode :: (IsNotInView => instr (ContractInp cp st) (ContractOut st)) -> ContractCode' instr cp st
- data Contract' instr cp st = (ParameterScope cp, StorageScope st) => Contract {
- cCode :: ContractCode' instr cp st
- cParamNotes :: ParamNotes cp
- cStoreNotes :: Notes st
- cViews :: ViewsSet' instr st
- cEntriesOrder :: EntriesOrder
- class IsNotInView
- giveNotInView :: (IsNotInView => r) -> r
- defaultContract :: (ParameterScope cp, StorageScope st) => (IsNotInView => instr (ContractInp cp st) (ContractOut st)) -> Contract' instr cp st
- mapContractCode :: (forall i o. instr i o -> instr i o) -> Contract' instr cp st -> Contract' instr cp st
- mapContractCodeBlock :: (instr (ContractInp cp st) (ContractOut st) -> instr (ContractInp cp st) (ContractOut st)) -> Contract' instr cp st -> Contract' instr cp st
- mapContractViewBlocks :: (forall arg ret. ViewCode' instr arg st ret -> ViewCode' instr arg st ret) -> Contract' instr cp st -> Contract' instr cp st
- mapEntriesOrdered :: Contract' instr cp st -> (ParamNotes cp -> a) -> (Notes st -> a) -> (ContractCode' instr cp st -> a) -> [a]
Contract
type ContractInp1 param st = 'TPair param st Source #
type ContractInp param st = '[ContractInp1 param st] Source #
type ContractOut1 st = 'TPair ('TList 'TOperation) st Source #
type ContractOut st = '[ContractOut1 st] Source #
newtype ContractCode' instr cp st Source #
A wrapper for contract code. The newtype is mostly there to avoid
accidentally passing code from inside ContractCode
into a view for example,
as semantics are slightly different.
ContractCode | |
|
Instances
mkContractCode :: (IsNotInView => instr (ContractInp cp st) (ContractOut st)) -> ContractCode' instr cp st Source #
A helper to construct ContractCode'
. This helper provides the constraint
that the contract code is not in a view.
data Contract' instr cp st Source #
Typed contract and information about annotations which is not present in the contract code.
(ParameterScope cp, StorageScope st) => Contract | |
|
Instances
ToExpression (Contract cp st) Source # | |
Defined in Morley.Micheline.Class toExpression :: Contract cp st -> Expression Source # | |
ContainsDoc (Contract cp st) Source # | |
Defined in Morley.Michelson.Typed.Doc buildDocUnfinalized :: Contract cp st -> ContractDoc Source # | |
ContainsUpdateableDoc (Contract cp st) Source # | |
Defined in Morley.Michelson.Typed.Doc modifyDocEntirely :: (SomeDocItem -> SomeDocItem) -> Contract cp st -> Contract cp st Source # | |
(forall (i :: [T]) (o :: [T]). Show (instr i o)) => Show (Contract' instr cp st) Source # | |
(forall (i :: [T]) (o :: [T]). NFData (instr i o)) => NFData (Contract' instr cp st) Source # | |
Defined in Morley.Michelson.Typed.Contract | |
(forall (i :: [T]) (o :: [T]). Eq (instr i o)) => Eq (Contract' instr cp st) Source # | |
class IsNotInView Source #
Constraint ensuring the given code does not appear on the top level of a
view. Some Michelson instructions are forbidden on the top level of views,
but allowed in main contract code, and also inside lambdas in views. Hence,
this constraint can be provided by mkContractCode
or by mkVLam
.
Instances
(TypeError ('Text "Not allowed on the top level of a view") :: Constraint) => IsNotInView Source # | |
Defined in Morley.Michelson.Typed.Contract |
giveNotInView :: (IsNotInView => r) -> r Source #
Pull a constraint IsNotInView
out of thin air. Use this with caution,
as you could easily construct an invalid contract by using this directly.
defaultContract :: (ParameterScope cp, StorageScope st) => (IsNotInView => instr (ContractInp cp st) (ContractOut st)) -> Contract' instr cp st Source #
mapContractCode :: (forall i o. instr i o -> instr i o) -> Contract' instr cp st -> Contract' instr cp st Source #
Map all the blocks with some code in the contract.
mapContractCodeBlock :: (instr (ContractInp cp st) (ContractOut st) -> instr (ContractInp cp st) (ContractOut st)) -> Contract' instr cp st -> Contract' instr cp st Source #
Transform contract code
block.
To map e.g. views too, see mapContractCode
.
mapContractViewBlocks :: (forall arg ret. ViewCode' instr arg st ret -> ViewCode' instr arg st ret) -> Contract' instr cp st -> Contract' instr cp st Source #
mapEntriesOrdered :: Contract' instr cp st -> (ParamNotes cp -> a) -> (Notes st -> a) -> (ContractCode' instr cp st -> a) -> [a] Source #
Map each typed contract fields by the given function and sort the output
based on the EntriesOrder
.