Safe Haskell | None |
---|---|
Language | Haskell2010 |
Michelson contract in untyped model.
Synopsis
- data EntriesOrder
- canonicalEntriesOrder :: EntriesOrder
- entriesOrderToInt :: EntriesOrder -> (Int, Int, Int)
- mapEntriesOrdered :: Contract' op -> (ParameterType -> a) -> (Storage -> a) -> ([op] -> a) -> (View' op -> a) -> [a]
- data ContractBlock op
- orderContractBlock :: [ContractBlock op] -> Maybe (Contract' op)
- data Contract' op = Contract {
- contractParameter :: ParameterType
- contractStorage :: Storage
- contractCode :: [op]
- entriesOrder :: EntriesOrder
- contractViews :: [View' op]
- data View' op = View {
- viewName :: ViewName
- viewArgument :: Ty
- viewReturn :: Ty
- viewCode :: [op]
- type Storage = Ty
- mapContractCode :: (op -> op) -> Contract' op -> Contract' op
Documentation
data EntriesOrder Source #
Top-level entries order of the contract. This is preserved due to the fact that it affects the output of pretty-printing and serializing contract.
Instances
canonicalEntriesOrder :: EntriesOrder Source #
The canonical entries order which is ordered as follow:
parameter
, storage
, and code
.
entriesOrderToInt :: EntriesOrder -> (Int, Int, Int) Source #
(Int, Int, Int)
is the positions of parameter
, storage
, and code
respectively.
mapEntriesOrdered :: Contract' op -> (ParameterType -> a) -> (Storage -> a) -> ([op] -> a) -> (View' op -> a) -> [a] Source #
Map each contract fields by the given function and sort the output
based on the EntriesOrder
.
data ContractBlock op Source #
Contract block, convenient when parsing
Instances
Functor ContractBlock Source # | |
Defined in Morley.Michelson.Untyped.Contract fmap :: (a -> b) -> ContractBlock a -> ContractBlock b # (<$) :: a -> ContractBlock b -> ContractBlock a # | |
Eq op => Eq (ContractBlock op) Source # | |
Defined in Morley.Michelson.Untyped.Contract (==) :: ContractBlock op -> ContractBlock op -> Bool # (/=) :: ContractBlock op -> ContractBlock op -> Bool # | |
Show op => Show (ContractBlock op) Source # | |
Defined in Morley.Michelson.Untyped.Contract showsPrec :: Int -> ContractBlock op -> ShowS # show :: ContractBlock op -> String # showList :: [ContractBlock op] -> ShowS # | |
Buildable (ContractBlock op) Source # | |
Defined in Morley.Michelson.Untyped.Contract build :: ContractBlock op -> Builder # |
orderContractBlock :: [ContractBlock op] -> Maybe (Contract' op) Source #
Construct a contract representation from the contract blocks (i.e. parameters,
storage, code blocks, etc.) in arbitrary order.
This makes sure that unique blocks like code
do not duplicate, and saves the
order in the contract so that it can print the contract blocks in the same
order it was parsed. TODO [#698]: this is not fully true now.
General untyped contract representation.
Contract | |
|
Instances
Untyped view in a contract.
View | |
|
Instances
Functor View' Source # | |
Eq op => Eq (View' op) Source # | |
Data op => Data (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> View' op -> c (View' op) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (View' op) # toConstr :: View' op -> Constr # dataTypeOf :: View' op -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (View' op)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (View' op)) # gmapT :: (forall b. Data b => b -> b) -> View' op -> View' op # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> View' op -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> View' op -> r # gmapQ :: (forall d. Data d => d -> u) -> View' op -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> View' op -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> View' op -> m (View' op) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> View' op -> m (View' op) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> View' op -> m (View' op) # | |
Show op => Show (View' op) Source # | |
Generic (View' op) Source # | |
NFData op => NFData (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View | |
ToJSON op => ToJSON (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View | |
FromJSON op => FromJSON (View' op) Source # | |
type Rep (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View type Rep (View' op) = D1 ('MetaData "View'" "Morley.Michelson.Untyped.View" "morley-1.16.4-inplace" 'False) (C1 ('MetaCons "View" 'PrefixI 'True) ((S1 ('MetaSel ('Just "viewName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ViewName) :*: S1 ('MetaSel ('Just "viewArgument") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Ty)) :*: (S1 ('MetaSel ('Just "viewReturn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Ty) :*: S1 ('MetaSel ('Just "viewCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [op])))) |
mapContractCode :: (op -> op) -> Contract' op -> Contract' op Source #
Map all the instructions appearing in the contract.