Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for declaring and documenting entry points.
Synopsis
- data DEntryPoint (kind :: Type) = DEntryPoint {}
- class EntryArrow kind name body where
- data PlainEntryPointsKind
- diEntryPointToMarkdown :: HeaderLevel -> DEntryPoint level -> Markdown
- data DEntryPointArg = DEntryPointArg {
- epaArg :: Maybe DType
- epaHasAnnotation :: Bool
- epaBuilding :: [ParamBuildingStep]
- epaType :: Type
- data DType where
- DType :: TypeHasDoc a => Proxy a -> DType
- class KnownSymbol con => DeriveCtorFieldDoc con (cf :: CtorField) where
- data ParamBuildingStep = ParamBuildingStep {
- pbsEnglish :: Markdown
- pbsHaskell :: CurrentParam -> Markdown
- pbsMichelson :: CurrentParam -> Markdown
- clarifyParamBuildingSteps :: ParamBuildingStep -> (inp :-> out) -> inp :-> out
- constructDEpArg :: forall arg. (TypeHasDoc arg, HasTypeAnn arg, KnownValue arg) => Bool -> DEntryPointArg
- emptyDEpArg :: Bool -> DEntryPointArg
- mkUType :: Sing x -> Notes x -> Type
- mkDEpUType :: forall t. (KnownValue t, HasTypeAnn t) => Type
- mkDEntryPointArgSimple :: forall t. (KnownValue t, HasTypeAnn t, TypeHasDoc t) => DEntryPointArg
- type DocumentEntryPoints kind a = (Generic a, GDocumentEntryPoints kind (Rep a))
- documentEntryPoint :: forall kind epName param s out. (KnownSymbol epName, DocItem (DEntryPoint kind), TypeHasDoc param, HasTypeAnn param, KnownValue param) => ((param & s) :-> out) -> (param & s) :-> out
- entryCase :: forall dt entryPointKind out inp clauses. (CaseTC dt out inp clauses, DocumentEntryPoints entryPointKind dt) => Proxy entryPointKind -> IsoRecTuple clauses -> (dt & inp) :-> out
- entryCase_ :: forall dt entryPointKind out inp. (InstrCaseC dt inp out, RMap (CaseClauses dt), DocumentEntryPoints entryPointKind dt) => Proxy entryPointKind -> Rec (CaseClauseL inp out) (CaseClauses dt) -> (dt & inp) :-> out
Documentation
data DEntryPoint (kind :: Type) Source #
Gathers information about single entrypoint.
We assume that entry points might be of different kinds,
which is designated by phantom type parameter.
For instance, you may want to have several groups of entry points
corresponding to various parts of a contract - specifying different kind
type argument for each of those groups will allow you defining different
DocItem
instances with appropriate custom descriptions for them.
Instances
class EntryArrow kind name body where Source #
Provides arror for convenient entrypoint documentation
(#->) :: (Label name, Proxy kind) -> body -> body Source #
Lift entrypoint implementation.
Entrypoint names should go with "e" prefix.
Instances
(name ~ AppendSymbol "e" epName, body ~ ((param & s) :-> out), KnownSymbol epName, DocItem (DEntryPoint kind), TypeHasDoc param, HasTypeAnn param, KnownValue param) => EntryArrow (kind :: Type) name body Source # | |
data PlainEntryPointsKind Source #
Default value for DEntryPoint
type argument.
Instances
diEntryPointToMarkdown :: HeaderLevel -> DEntryPoint level -> Markdown Source #
Default implementation of docItemToMarkdown
for entry points.
data DEntryPointArg Source #
Describes argument of an entrypoint.
DEntryPointArg | |
|
Instances
DocItem DEntryPointArg Source # | |
Defined in Lorentz.EntryPoints.Doc type DocItemPosition DEntryPointArg = (pos :: Nat) Source # type DocItemPlacement DEntryPointArg :: DocItemPlacementKind Source # docItemSectionName :: Maybe Text Source # docItemSectionDescription :: Maybe Markdown Source # docItemSectionNameStyle :: DocSectionNameStyle Source # docItemRef :: DEntryPointArg -> DocItemRef (DocItemPlacement DEntryPointArg) Source # docItemToMarkdown :: HeaderLevel -> DEntryPointArg -> Markdown Source # docItemDependencies :: DEntryPointArg -> [SomeDocDefinitionItem] Source # docItemsOrder :: [DEntryPointArg] -> [DEntryPointArg] Source # | |
type DocItemPosition DEntryPointArg Source # | |
Defined in Lorentz.EntryPoints.Doc | |
type DocItemPlacement DEntryPointArg Source # | |
Defined in Lorentz.EntryPoints.Doc |
Doc element with description of a type.
DType :: TypeHasDoc a => Proxy a -> DType |
Instances
Eq DType Source # | |
Ord DType Source # | |
Show DType Source # | |
DocItem DType Source # | |
Defined in Michelson.Typed.Haskell.Doc type DocItemPosition DType = (pos :: Nat) Source # type DocItemPlacement DType :: DocItemPlacementKind Source # docItemSectionName :: Maybe Text Source # docItemSectionDescription :: Maybe Markdown Source # docItemSectionNameStyle :: DocSectionNameStyle Source # docItemRef :: DType -> DocItemRef (DocItemPlacement DType) Source # docItemToMarkdown :: HeaderLevel -> DType -> Markdown Source # docItemDependencies :: DType -> [SomeDocDefinitionItem] Source # docItemsOrder :: [DType] -> [DType] Source # | |
type DocItemPosition DType Source # | |
Defined in Michelson.Typed.Haskell.Doc | |
type DocItemPlacement DType Source # | |
Defined in Michelson.Typed.Haskell.Doc |
class KnownSymbol con => DeriveCtorFieldDoc con (cf :: CtorField) where Source #
Pick a type documentation from CtorField
.
Instances
KnownSymbol con => DeriveCtorFieldDoc con NoFields Source # | |
Defined in Lorentz.EntryPoints.Doc | |
(TypeHasDoc ty, HasTypeAnn ty, KnownValue ty, KnownSymbol con) => DeriveCtorFieldDoc con (OneField ty) Source # | |
Defined in Lorentz.EntryPoints.Doc |
data ParamBuildingStep Source #
Describes a parameter building step.
This can be wrapping into (Haskell) constructor, or a more complex transformation.
ParamBuildingStep | |
|
clarifyParamBuildingSteps :: ParamBuildingStep -> (inp :-> out) -> inp :-> out Source #
Go over contract code and update every occurrence of DEntryPointArg
documentation item, adding the given step to its "how to build parameter"
description.
constructDEpArg :: forall arg. (TypeHasDoc arg, HasTypeAnn arg, KnownValue arg) => Bool -> DEntryPointArg Source #
emptyDEpArg :: Bool -> DEntryPointArg Source #
mkDEpUType :: forall t. (KnownValue t, HasTypeAnn t) => Type Source #
mkDEntryPointArgSimple :: forall t. (KnownValue t, HasTypeAnn t, TypeHasDoc t) => DEntryPointArg Source #
type DocumentEntryPoints kind a = (Generic a, GDocumentEntryPoints kind (Rep a)) Source #
Constraint for documentEntryPoints
.
documentEntryPoint :: forall kind epName param s out. (KnownSymbol epName, DocItem (DEntryPoint kind), TypeHasDoc param, HasTypeAnn param, KnownValue param) => ((param & s) :-> out) -> (param & s) :-> out Source #
Wrapper for documenting single entrypoint which parameter isn't going to be unwrapped from some datatype.
entryCase
unwraps a datatype, however, sometimes we want to
have entrypoint parameter to be not wrapped into some datatype.
entryCase :: forall dt entryPointKind out inp clauses. (CaseTC dt out inp clauses, DocumentEntryPoints entryPointKind dt) => Proxy entryPointKind -> IsoRecTuple clauses -> (dt & inp) :-> out Source #
Version of entryCase_
for tuples.
entryCase_ :: forall dt entryPointKind out inp. (InstrCaseC dt inp out, RMap (CaseClauses dt), DocumentEntryPoints entryPointKind dt) => Proxy entryPointKind -> Rec (CaseClauseL inp out) (CaseClauses dt) -> (dt & inp) :-> out Source #
Like case_
, to be used for pattern-matching on parameter.
Modifies documentation accordingly. Including description of
entrypoints' arguments, thus for them you will need to supply
TypeHasDoc
instance.