Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for lightweight entrypoints support.
Synopsis
- data EpAddress = EpAddress {}
- data ParseEpAddressError
- formatEpAddress :: EpAddress -> Text
- mformatEpAddress :: EpAddress -> MText
- parseEpAddress :: Text -> Either ParseEpAddressError EpAddress
- unsafeParseEpAddress :: HasCallStack => Text -> EpAddress
- data ParamNotes (t :: T) = ParamNotesUnsafe {}
- pattern ParamNotes :: Notes t -> RootAnn -> ParamNotes t
- starParamNotes :: SingI t => ParamNotes t
- data ArmCoord
- type ArmCoords = [ArmCoord]
- data ParamEpError
- mkParamNotes :: Notes t -> RootAnn -> Either ParamEpError (ParamNotes t)
- data EpLiftSequence (arg :: T) (param :: T) where
- EplArgHere :: EpLiftSequence arg arg
- EplWrapLeft :: EpLiftSequence arg subparam -> EpLiftSequence arg ('TOr subparam r)
- EplWrapRight :: EpLiftSequence arg subparam -> EpLiftSequence arg ('TOr l subparam)
- data EntryPointCallT (param :: T) (arg :: T) = ParameterScope arg => EntryPointCall {
- epcName :: EpName
- epcParamProxy :: Proxy param
- epcLiftSequence :: EpLiftSequence arg param
- epcPrimitive :: forall p. (ParameterScope p, ForbidOr p) => EntryPointCallT p p
- epcCallRootUnsafe :: ParameterScope param => EntryPointCallT param param
- data SomeEntryPointCallT (arg :: T) = forall param.ParameterScope param => SomeEpc (EntryPointCallT param arg)
- sepcCallRootUnsafe :: ParameterScope param => SomeEntryPointCallT param
- sepcPrimitive :: forall t. (ParameterScope t, ForbidOr t) => SomeEntryPointCallT t
- sepcName :: SomeEntryPointCallT arg -> EpName
- type family ForbidOr (t :: T) :: Constraint where ...
- data MkEntryPointCallRes param where
- MkEntryPointCallRes :: ParameterScope arg => Notes arg -> EntryPointCallT param arg -> MkEntryPointCallRes param
- mkEntryPointCall :: ParameterScope param => EpName -> ParamNotes param -> Maybe (MkEntryPointCallRes param)
- tyImplicitAccountParam :: ParamNotes 'TUnit
- flattenEntryPoints :: SingI t => ParamNotes t -> Map EpName Type
- newtype EpName = EpNameUnsafe {}
- pattern DefEpName :: EpName
- epNameFromParamAnn :: FieldAnn -> Maybe EpName
- epNameToParamAnn :: EpName -> FieldAnn
- epNameFromRefAnn :: FieldAnn -> Either EpNameFromRefAnnError EpName
- epNameToRefAnn :: EpName -> FieldAnn
- data EpNameFromRefAnnError = InEpNameBadAnnotation FieldAnn
Documentation
Address with optional entrypoint name attached to it. TODO: come up with better name?
EpAddress | |
|
Instances
data ParseEpAddressError Source #
ParseEpAddressBadAddress ParseAddressError | |
ParseEpAddressBadRefAnn Text | |
ParseEpAddressRefAnnError EpNameFromRefAnnError |
Instances
formatEpAddress :: EpAddress -> Text Source #
mformatEpAddress :: EpAddress -> MText Source #
parseEpAddress :: Text -> Either ParseEpAddressError EpAddress Source #
Parse an address which can be suffixed with entrypoint name (e.g. "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU%entrypoint").
unsafeParseEpAddress :: HasCallStack => Text -> EpAddress Source #
data ParamNotes (t :: T) Source #
Annotations for contract parameter declaration.
Following the Michelson specification, this type has the following invariants:
1. No entrypoint name is duplicated.
2. If default
entrypoint is explicitly assigned, no "arm" remains uncallable.
Instances
pattern ParamNotes :: Notes t -> RootAnn -> ParamNotes t Source #
starParamNotes :: SingI t => ParamNotes t Source #
Parameter without annotations.
data ParamEpError Source #
Errors specific to parameter type declaration (entrypoints).
Instances
mkParamNotes :: Notes t -> RootAnn -> Either ParamEpError (ParamNotes t) Source #
Construct ParamNotes
performing all necessary checks.
data EpLiftSequence (arg :: T) (param :: T) where Source #
Describes how to construct full contract parameter from given entrypoint argument.
This could be just wrapper over Value arg -> Value param
, but we cannot
use Value
type in this module easily.
EplArgHere :: EpLiftSequence arg arg | |
EplWrapLeft :: EpLiftSequence arg subparam -> EpLiftSequence arg ('TOr subparam r) | |
EplWrapRight :: EpLiftSequence arg subparam -> EpLiftSequence arg ('TOr l subparam) |
Instances
Eq (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: EpLiftSequence arg param -> EpLiftSequence arg param -> Bool # (/=) :: EpLiftSequence arg param -> EpLiftSequence arg param -> Bool # | |
Show (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> EpLiftSequence arg param -> ShowS # show :: EpLiftSequence arg param -> String # showList :: [EpLiftSequence arg param] -> ShowS # | |
NFData (EpLiftSequence param arg) Source # | |
Defined in Michelson.Typed.EntryPoints rnf :: EpLiftSequence param arg -> () # | |
Buildable (EpLiftSequence arg param) Source # | |
Defined in Michelson.Typed.EntryPoints build :: EpLiftSequence arg param -> Builder # |
data EntryPointCallT (param :: T) (arg :: T) Source #
Reference for calling a specific entrypoint of type arg
.
ParameterScope arg => EntryPointCall | |
|
Instances
Eq (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: EntryPointCallT param arg -> EntryPointCallT param arg -> Bool # (/=) :: EntryPointCallT param arg -> EntryPointCallT param arg -> Bool # | |
Show (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> EntryPointCallT param arg -> ShowS # show :: EntryPointCallT param arg -> String # showList :: [EntryPointCallT param arg] -> ShowS # | |
NFData (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints rnf :: EntryPointCallT param arg -> () # | |
Buildable (EntryPointCallT param arg) Source # | |
Defined in Michelson.Typed.EntryPoints build :: EntryPointCallT param arg -> Builder # |
epcPrimitive :: forall p. (ParameterScope p, ForbidOr p) => EntryPointCallT p p Source #
Call parameter which has no entrypoints, always safe.
epcCallRootUnsafe :: ParameterScope param => EntryPointCallT param param Source #
Construct EntryPointCallT
which calls no entrypoint and assumes that
there is no explicit "default" one.
Validity of such operation is not ensured.
data SomeEntryPointCallT (arg :: T) Source #
EntryPointCallT
with hidden parameter type.
This requires argument to satisfy ParameterScope
constraint.
Strictly speaking, entrypoint argument may one day start having different
set of constraints comparing to ones applied to parameter, but this seems
unlikely.
forall param.ParameterScope param => SomeEpc (EntryPointCallT param arg) |
Instances
Eq (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints (==) :: SomeEntryPointCallT arg -> SomeEntryPointCallT arg -> Bool # (/=) :: SomeEntryPointCallT arg -> SomeEntryPointCallT arg -> Bool # | |
Show (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints showsPrec :: Int -> SomeEntryPointCallT arg -> ShowS # show :: SomeEntryPointCallT arg -> String # showList :: [SomeEntryPointCallT arg] -> ShowS # | |
NFData (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints rnf :: SomeEntryPointCallT arg -> () # | |
Buildable (SomeEntryPointCallT arg) Source # | |
Defined in Michelson.Typed.EntryPoints build :: SomeEntryPointCallT arg -> Builder # |
sepcCallRootUnsafe :: ParameterScope param => SomeEntryPointCallT param Source #
Construct SomeEntryPointCallT
which calls no entrypoint and assumes that
there is no explicit "default" one.
Validity of such operation is not ensured.
sepcPrimitive :: forall t. (ParameterScope t, ForbidOr t) => SomeEntryPointCallT t Source #
Call parameter which has no entrypoints, always safe.
sepcName :: SomeEntryPointCallT arg -> EpName Source #
type family ForbidOr (t :: T) :: Constraint where ... Source #
data MkEntryPointCallRes param where Source #
MkEntryPointCallRes :: ParameterScope arg => Notes arg -> EntryPointCallT param arg -> MkEntryPointCallRes param |
mkEntryPointCall :: ParameterScope param => EpName -> ParamNotes param -> Maybe (MkEntryPointCallRes param) Source #
Build EntryPointCallT
.
Here we accept entrypoint name and type information for the parameter of target contract.
Returns Nothing
if entrypoint is not found.
tyImplicitAccountParam :: ParamNotes 'TUnit Source #
Parameter type of implicit account.
flattenEntryPoints :: SingI t => ParamNotes t -> Map EpName Type Source #
Flatten a provided list of notes to a map of its entrypoints and its
corresponding utype. Please refer to mkEntrypointsMap
in regards to how
duplicate entrypoints are handled.
Re-exports
Entrypoint name.
Empty if this entrypoint is default one. Cannot be equal to "default", the reference implementation forbids that. Also, set of allowed characters should be the same as in annotations.
Instances
Eq EpName Source # | |
Ord EpName Source # | |
Show EpName Source # | |
Generic EpName Source # | |
Arbitrary FieldAnn => Arbitrary EpName Source # | |
NFData EpName Source # | |
Defined in Michelson.Untyped.EntryPoints | |
Default EpName Source # | |
Defined in Michelson.Untyped.EntryPoints | |
Buildable EpName Source # | |
Defined in Michelson.Untyped.EntryPoints | |
HasCLReader EpName Source # | |
Defined in Michelson.Untyped.EntryPoints | |
type Rep EpName Source # | |
Defined in Michelson.Untyped.EntryPoints |
epNameToParamAnn :: EpName -> FieldAnn Source #
Turn entrypoint name into annotation for contract parameter declaration.
epNameFromRefAnn :: FieldAnn -> Either EpNameFromRefAnnError EpName Source #
Make up EpName
from annotation which is reference to an entrypoint
(e.g. annotation in CONTRACT
instruction).
Fails if annotation is invalid.
epNameToRefAnn :: EpName -> FieldAnn Source #
Turn entrypoint name into annotation used as reference to entrypoint.
data EpNameFromRefAnnError Source #