morley-1.20.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Typed.Contract

Contents

Description

Module, containing top-level entries of a Michelson contract.

Synopsis

Contract

type ContractInp1 param st = 'TPair param st Source #

type ContractInp param st = '[ContractInp1 param 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.

Constructors

ContractCode 

Fields

Instances

Instances details
ContainsDoc (ContractCode inp out) Source # 
Instance details

Defined in Morley.Michelson.Typed.Doc

ContainsUpdateableDoc (ContractCode inp out) Source # 
Instance details

Defined in Morley.Michelson.Typed.Doc

Show (instr (ContractInp cp st) (ContractOut st)) => Show (ContractCode' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

showsPrec :: Int -> ContractCode' instr cp st -> ShowS #

show :: ContractCode' instr cp st -> String #

showList :: [ContractCode' instr cp st] -> ShowS #

NFData (instr (ContractInp cp st) (ContractOut st)) => NFData (ContractCode' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

rnf :: ContractCode' instr cp st -> () #

Eq (instr (ContractInp cp st) (ContractOut st)) => Eq (ContractCode' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

(==) :: ContractCode' instr cp st -> ContractCode' instr cp st -> Bool #

(/=) :: ContractCode' instr cp st -> ContractCode' instr cp st -> Bool #

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.

Constructors

(ParameterScope cp, StorageScope st) => Contract 

Instances

Instances details
ToExpression (Contract cp st) Source # 
Instance details

Defined in Morley.Micheline.Class

ContainsDoc (Contract cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Doc

ContainsUpdateableDoc (Contract cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Doc

(forall (i :: [T]) (o :: [T]). Show (instr i o)) => Show (Contract' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

showsPrec :: Int -> Contract' instr cp st -> ShowS #

show :: Contract' instr cp st -> String #

showList :: [Contract' instr cp st] -> ShowS #

(forall (i :: [T]) (o :: [T]). NFData (instr i o)) => NFData (Contract' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

rnf :: Contract' instr cp st -> () #

(forall (i :: [T]) (o :: [T]). Eq (instr i o)) => Eq (Contract' instr cp st) Source # 
Instance details

Defined in Morley.Michelson.Typed.Contract

Methods

(==) :: Contract' instr cp st -> Contract' instr cp st -> Bool #

(/=) :: Contract' instr cp st -> Contract' instr cp st -> Bool #

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

Instances details
(TypeError ('Text "Not allowed on the top level of a view") :: Constraint) => IsNotInView Source # 
Instance details

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 #

mapContractCodeM :: Monad m => (forall i o. instr i o -> m (instr i o)) -> Contract' instr cp st -> m (Contract' instr cp st) Source #

Map all the blocks with some code in the contract, monadic version.

mapContractCodeBlockM :: Monad m => (instr (ContractInp cp st) (ContractOut st) -> m (instr (ContractInp cp st) (ContractOut st))) -> Contract' instr cp st -> m (Contract' instr cp st) Source #

Transform contract code block, monadic version.

To map e.g. views too, see mapContractCodeM.

mapContractViewBlocksM :: Monad m => (forall arg ret. ViewCode' instr arg st ret -> m (ViewCode' instr arg st ret)) -> Contract' instr cp st -> m (Contract' instr cp st) Source #