Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Module that defines Expression type, its related types and its JSON instance.
Synopsis
- data Exp x where
- ExpInt (XExpInt x) Integer
- ExpString (XExpString x) Text
- ExpBytes (XExpBytes x) ByteString
- ExpSeq (XExpSeq x) [Exp x]
- ExpPrim (XExpPrim x) (MichelinePrimAp x)
- ExpX (XExp x)
- pattern ExpPrim' :: XExpPrim x -> MichelinePrimitive -> [Exp x] -> [Annotation] -> Exp x
- expressionInt :: Integer -> Expression
- expressionString :: Text -> Expression
- expressionBytes :: ByteString -> Expression
- expressionSeq :: [Expression] -> Expression
- expressionPrim :: MichelinePrimAp RegularExp -> Expression
- expressionPrim' :: Text -> [Expression] -> [Annotation] -> Expression
- data RegularExp :: ExpExtensionDescriptorKind
- type Expression = Exp RegularExp
- data MichelinePrimAp x = MichelinePrimAp {
- mpaPrim :: MichelinePrimitive
- mpaArgs :: [Exp x]
- mpaAnnots :: [Annotation]
- newtype MichelinePrimitive = MichelinePrimitive Text
- michelsonPrimitive :: Seq Text
- type ExpExtensionDescriptorKind = ExpExtensionTag -> Type
- class ExpExtensionDescriptor (x :: ExpExtensionDescriptorKind) where
- type ExpExtrasConstrained c x = Each '[c] [XExpInt x, XExpString x, XExpBytes x, XExpSeq x, XExpPrim x]
- type ExpAllExtrasConstrainted c x = (ExpExtrasConstrained c x, c (XExp x))
- data ExpExtras f x = ExpExtras {}
- mkUniformExpExtras :: (extra ~ XExpInt x, extra ~ XExpString x, extra ~ XExpBytes x, extra ~ XExpSeq x, extra ~ XExpPrim x) => f extra -> ExpExtras f x
- hoistExpExtras :: (forall extra. f1 extra -> f2 extra) -> ExpExtras f1 x -> ExpExtras f2 x
- data Annotation
- annotToText :: Annotation -> Text
- annotFromText :: forall m. MonadFail m => Text -> m Annotation
- isAnnotationField :: Annotation -> Bool
- isAnnotationType :: Annotation -> Bool
- isAnnotationVariable :: Annotation -> Bool
- isNoAnn :: Annotation -> Bool
- mkAnns :: [TypeAnn] -> [FieldAnn] -> [VarAnn] -> [Annotation]
- toAnnSet :: [Annotation] -> AnnotationSet
- mkAnnsFromAny :: [AnyAnn] -> [Annotation]
- _ExpInt :: Prism' (Exp d) (XExpInt d, Integer)
- _ExpString :: Prism' (Exp d) (XExpString d, Text)
- _ExpBytes :: Prism' (Exp d) (XExpBytes d, ByteString)
- _ExpSeq :: Prism' (Exp d) (XExpSeq d, [Exp d])
- _ExpPrim :: Prism' (Exp d) (XExpPrim d, MichelinePrimAp d)
- _ExpressionInt :: Prism' Expression Integer
- _ExpressionString :: Prism' Expression Text
- _ExpressionBytes :: Prism' Expression ByteString
- _ExpressionSeq :: Prism' Expression [Expression]
- _ExpressionPrim :: Prism' Expression (MichelinePrimAp RegularExp)
- _AnnotationField :: Prism' Annotation FieldAnn
- _AnnotationVariable :: Prism' Annotation VarAnn
- _AnnotationType :: Prism' Annotation TypeAnn
- mpaPrimL :: forall x. Lens' (MichelinePrimAp x) MichelinePrimitive
- mpaArgsL :: forall x x. Lens (MichelinePrimAp x) (MichelinePrimAp x) [Exp x] [Exp x]
- mpaAnnotsL :: forall x. Lens' (MichelinePrimAp x) [Annotation]
Documentation
Type for Micheline Expression with extension points.
Following the Trees-that-Grow approach, this type provides the core set
of constructors used by Tezos accompanied with additional data (XExp*
).
Plus additional constructors provided by XExp
.
The type argument x
will be called extension descriptor and it must have
ExpExtensionDescriptor
instance.
ExpInt (XExpInt x) Integer | |
ExpString (XExpString x) Text | |
ExpBytes (XExpBytes x) ByteString | |
ExpSeq (XExpSeq x) [Exp x] | |
ExpPrim (XExpPrim x) (MichelinePrimAp x) | |
ExpX (XExp x) |
pattern ExpPrim' :: XExpPrim x -> MichelinePrimitive -> [Exp x] -> [Annotation] -> Exp x |
Instances
FromJSON Expression Source # | |
Defined in Morley.Micheline.Expression parseJSON :: Value -> Parser Expression # parseJSONList :: Value -> Parser [Expression] # | |
ToJSON Expression Source # | |
Defined in Morley.Micheline.Expression toJSON :: Expression -> Value # toEncoding :: Expression -> Encoding # toJSONList :: [Expression] -> Value # toEncodingList :: [Expression] -> Encoding # | |
Buildable Expression Source # | |
Defined in Morley.Micheline.Expression build :: Expression -> Builder # | |
ToExpression Expression Source # | |
Defined in Morley.Micheline.Class toExpression :: Expression -> Expression Source # | |
ExpAllExtrasConstrainted (Lift :: Type -> Constraint) x => Lift (Exp x :: Type) Source # | |
(ExpAllExtrasConstrainted Data x, Typeable x) => Data (Exp x) Source # | |
Defined in Morley.Micheline.Expression gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Exp x -> c (Exp x) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Exp x) # dataTypeOf :: Exp x -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Exp x)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Exp x)) # gmapT :: (forall b. Data b => b -> b) -> Exp x -> Exp x # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Exp x -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Exp x -> r # gmapQ :: (forall d. Data d => d -> u) -> Exp x -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Exp x -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Exp x -> m (Exp x) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Exp x -> m (Exp x) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Exp x -> m (Exp x) # | |
ExpAllExtrasConstrainted Show x => Show (Exp x) Source # | |
ExpAllExtrasConstrainted Eq x => Eq (Exp x) Source # | |
(Typeable x, ExpAllExtrasConstrainted Data x, ExpAllExtrasConstrainted (Typeable :: Type -> Constraint) x) => Plated (Exp x) Source # | Default instance that uses If it tries to find expressions for polymorphic types too agressively
(requiring |
Defined in Morley.Micheline.Expression plate :: Traversal' (Exp x) (Exp x) # |
expressionInt :: Integer -> Expression Source #
expressionString :: Text -> Expression Source #
expressionSeq :: [Expression] -> Expression Source #
expressionPrim' :: Text -> [Expression] -> [Annotation] -> Expression Source #
data RegularExp :: ExpExtensionDescriptorKind Source #
Extension descriptor for plain expressions without additional data.
Instances
type Expression = Exp RegularExp Source #
Simple expression without any extras.
data MichelinePrimAp x Source #
MichelinePrimAp | |
|
Instances
newtype MichelinePrimitive Source #
Instances
type ExpExtensionDescriptorKind = ExpExtensionTag -> Type Source #
Kind of extension descriptors.
We use a dedicated open type for this, not just Type
, to notice earlier
when type arguments are mis-placed.
class ExpExtensionDescriptor (x :: ExpExtensionDescriptorKind) Source #
Defines details of extension descriptor.
type XExpInt x :: Type Source #
Additional data in ExpInt
constructor.
type XExpInt _ = ()
type XExpString x :: Type Source #
Additional data in ExpString
constructor.
type XExpString _ = ()
type XExpBytes x :: Type Source #
Additional data in ExpBytes
constructor.
type XExpBytes _ = ()
type XExpSeq x :: Type Source #
Additional data in ExpSeq
constructor.
type XExpSeq _ = ()
type XExpPrim x :: Type Source #
Additional data in ExpPrim
constructor.
type XExpPrim _ = ()
Additional constructors.
Instances
ExpExtensionDescriptor RegularExp Source # | |
Defined in Morley.Micheline.Expression type XExpInt RegularExp Source # type XExpString RegularExp Source # type XExpBytes RegularExp Source # type XExpSeq RegularExp Source # type XExpPrim RegularExp Source # type XExp RegularExp Source # | |
ExpExtensionDescriptor (WithMeta m) Source # | |
type ExpExtrasConstrained c x = Each '[c] [XExpInt x, XExpString x, XExpBytes x, XExpSeq x, XExpPrim x] Source #
Constraint all the extra fields provided by this extension.
type ExpAllExtrasConstrainted c x = (ExpExtrasConstrained c x, c (XExp x)) Source #
Constraint all the extra fields and the constructor provided by this extension.
A helper type that carries something for all extra fields.
Fields are carried in the given functor f
so that one could provide
a generator, parser or something else.
Extra constructor is not included here as it may need special treatment, you have to carry it separately.
mkUniformExpExtras :: (extra ~ XExpInt x, extra ~ XExpString x, extra ~ XExpBytes x, extra ~ XExpSeq x, extra ~ XExpPrim x) => f extra -> ExpExtras f x Source #
Fill ExpExtras
with the same data, assuming all types of extras are
the same.
hoistExpExtras :: (forall extra. f1 extra -> f2 extra) -> ExpExtras f1 x -> ExpExtras f2 x Source #
Change the functor used in ExpExtras
.
data Annotation Source #
Instances
annotToText :: Annotation -> Text Source #
annotFromText :: forall m. MonadFail m => Text -> m Annotation Source #
isAnnotationField :: Annotation -> Bool Source #
isAnnotationType :: Annotation -> Bool Source #
isNoAnn :: Annotation -> Bool Source #
toAnnSet :: [Annotation] -> AnnotationSet Source #
mkAnnsFromAny :: [AnyAnn] -> [Annotation] Source #
Prisms
_ExpString :: Prism' (Exp d) (XExpString d, Text) Source #
Lenses
mpaPrimL :: forall x. Lens' (MichelinePrimAp x) MichelinePrimitive Source #
mpaArgsL :: forall x x. Lens (MichelinePrimAp x) (MichelinePrimAp x) [Exp x] [Exp x] Source #
mpaAnnotsL :: forall x. Lens' (MichelinePrimAp x) [Annotation] Source #