Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Michelson contract in untyped model.
Synopsis
- newtype EntriesOrder = EntriesOrder {}
- data Entry
- canonicalEntriesOrder :: EntriesOrder
- mapEntriesOrdered :: Contract' op -> (ParameterType -> a) -> (Storage -> a) -> (op -> a) -> (View' op -> a) -> [a]
- mkEntriesOrder :: [Entry] -> EntriesOrder
- data ContractBlock op
- data ContractBlockError
- orderContractBlock :: forall op. [ContractBlock op] -> Either (NonEmpty ContractBlockError) (Contract' op)
- data Contract' op = Contract {}
- data View' op = View {
- viewName :: ViewName
- viewArgument :: Ty
- viewReturn :: Ty
- viewCode :: op
- type Storage = Ty
Documentation
newtype 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
Instances
FromJSON Entry Source # | |
FromJSONKey Entry Source # | |
ToJSON Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract | |
ToJSONKey Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract | |
Data Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Entry -> c Entry # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Entry # dataTypeOf :: Entry -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Entry) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Entry) # gmapT :: (forall b. Data b => b -> b) -> Entry -> Entry # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Entry -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Entry -> r # gmapQ :: (forall d. Data d => d -> u) -> Entry -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Entry -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Entry -> m Entry # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Entry -> m Entry # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Entry -> m Entry # | |
Generic Entry Source # | |
Show Entry Source # | |
NFData Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract | |
Eq Entry Source # | |
Ord Entry Source # | |
Buildable Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract | |
type Rep Entry Source # | |
Defined in Morley.Michelson.Untyped.Contract type Rep Entry = D1 ('MetaData "Entry" "Morley.Michelson.Untyped.Contract" "morley-1.20.0-inplace" 'False) ((C1 ('MetaCons "EntryParameter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EntryStorage" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "EntryCode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EntryView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ViewName)))) |
canonicalEntriesOrder :: EntriesOrder Source #
The canonical entries order which is ordered as follow:
parameter
, storage
, and code
.
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
.
mkEntriesOrder :: [Entry] -> EntriesOrder Source #
Helper to construct EntriesOrder
from an ordered list of entires.
Duplicate entires are ignored.
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 # | |
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 # | |
Eq op => Eq (ContractBlock op) Source # | |
Defined in Morley.Michelson.Untyped.Contract (==) :: ContractBlock op -> ContractBlock op -> Bool # (/=) :: ContractBlock op -> ContractBlock op -> Bool # | |
Buildable (ContractBlock op) Source # | |
Defined in Morley.Michelson.Untyped.Contract build :: ContractBlock op -> Doc buildList :: [ContractBlock op] -> Doc |
data ContractBlockError Source #
Instances
Show ContractBlockError Source # | |
Defined in Morley.Michelson.Untyped.Contract showsPrec :: Int -> ContractBlockError -> ShowS # show :: ContractBlockError -> String # showList :: [ContractBlockError] -> ShowS # | |
Eq ContractBlockError Source # | |
Defined in Morley.Michelson.Untyped.Contract (==) :: ContractBlockError -> ContractBlockError -> Bool # (/=) :: ContractBlockError -> ContractBlockError -> Bool # | |
Buildable ContractBlockError Source # | |
Defined in Morley.Michelson.Untyped.Contract build :: ContractBlockError -> Doc buildList :: [ContractBlockError] -> Doc |
orderContractBlock :: forall op. [ContractBlock op] -> Either (NonEmpty ContractBlockError) (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.
General untyped contract representation.
Contract | |
|
Instances
Untyped view in a contract.
View | |
|
Instances
Functor View' Source # | |
FromJSON op => FromJSON (View' op) Source # | |
ToJSON op => ToJSON (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View | |
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) # | |
Generic (View' op) Source # | |
Show op => Show (View' op) Source # | |
NFData op => NFData (View' op) Source # | |
Defined in Morley.Michelson.Untyped.View | |
Eq op => Eq (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.20.0-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)))) |