{-# OPTIONS_GHC -Wno-redundant-constraints #-}
module Morley.Michelson.Typed.Haskell.Doc
( ADTRep
, ConstructorRep (..)
, crNameL, crDescriptionL, crFieldsL
, FieldRep (..)
, frNameL, frDescriptionL, frTypeRepL
, WithinParens (..)
, TypeHasDoc (..)
, TypeDocHaskellRep
, TypeDocMichelsonRep
, FieldDescriptions
, PolyTypeHasDocC
, SomeTypeWithDoc (..)
, typeDocBuiltMichelsonRep
, HaveCommonTypeCtor
, IsHomomorphic
, genericTypeDocDependencies
, customTypeDocMdReference
, customTypeDocMdReference'
, homomorphicTypeDocMdReference
, poly1TypeDocMdReference
, poly2TypeDocMdReference
, homomorphicTypeDocHaskellRep
, concreteTypeDocHaskellRep
, unsafeConcreteTypeDocHaskellRep
, haskellAddNewtypeField
, haskellRepNoFields
, haskellRepStripFieldPrefix
, homomorphicTypeDocMichelsonRep
, concreteTypeDocMichelsonRep
, unsafeConcreteTypeDocMichelsonRep
, DType (..)
, DStorageType (..)
, dStorage
, GTypeHasDoc
, GProductHasDoc
, dTypeDep
, dTypeDepP
, buildADTRep
, applyWithinParens
, buildTypeWithinParens
) where
import Control.Lens (_Just, each, to)
import Data.Char (isLower, isUpper, toLower)
import Data.List (lookup)
import Data.Singletons (SingI, demote)
import qualified Data.Text as T
import Data.Typeable (typeRep, typeRepArgs)
import Fmt (Buildable, Builder, build, (+|), (|+))
import GHC.Generics ((:*:)(..), (:+:)(..))
import qualified GHC.Generics as G
import GHC.TypeLits (ErrorMessage(..), KnownSymbol, TypeError, symbolVal)
import qualified Text.Show
import Type.Showtype (Showtype(..))
import Morley.Michelson.Doc
import Morley.Michelson.Text
import Morley.Michelson.Typed.Aliases
import Morley.Michelson.Typed.Entrypoints
import Morley.Michelson.Typed.Haskell.ValidateDescription
import Morley.Michelson.Typed.Haskell.Value
import Morley.Michelson.Typed.T
import Morley.Tezos.Address
import Morley.Tezos.Core
import Morley.Tezos.Crypto
import Morley.Util.Generic
import Morley.Util.Lens
import Morley.Util.Markdown
import Morley.Util.Named
import Morley.Util.Typeable
type ADTRep a = [ConstructorRep a]
data ConstructorRep a = ConstructorRep
{ ConstructorRep a -> Text
crName :: Text
, ConstructorRep a -> Maybe Text
crDescription :: Maybe Text
, ConstructorRep a -> [FieldRep a]
crFields :: [FieldRep a]
}
data FieldRep a = FieldRep
{ FieldRep a -> Maybe Text
frName :: Maybe Text
, FieldRep a -> Maybe Text
frDescription :: Maybe Text
, FieldRep a -> a
frTypeRep :: a
}
makeLensesWith postfixLFields ''ConstructorRep
makeLensesWith postfixLFields ''FieldRep
buildADTRep :: forall a. (WithinParens -> a -> Markdown) -> ADTRep a -> Markdown
buildADTRep :: (WithinParens -> a -> Markdown) -> ADTRep a -> Markdown
buildADTRep WithinParens -> a -> Markdown
buildField = \case
[] -> Markdown -> Markdown
mdItalic Markdown
"no values"
[ctor :: ConstructorRep a
ctor@ConstructorRep{[FieldRep a]
Maybe Text
Text
crFields :: [FieldRep a]
crDescription :: Maybe Text
crName :: Text
crFields :: forall a. ConstructorRep a -> [FieldRep a]
crDescription :: forall a. ConstructorRep a -> Maybe Text
crName :: forall a. ConstructorRep a -> Text
..}] -> WithinParens -> ConstructorRep a -> [FieldRep a] -> Markdown
renderProduct (Bool -> WithinParens
WithinParens Bool
False) ConstructorRep a
ctor [FieldRep a]
crFields
ADTRep a
ps -> (Markdown -> Markdown -> Markdown
forall a. Monoid a => a -> a -> a
mappend (Markdown -> Markdown
mdItalic Markdown
"one of" Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
" \n")) (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$
(Element (ADTRep a) -> Markdown) -> ADTRep a -> Markdown
forall t m. (Container t, Monoid m) => (Element t -> m) -> t -> m
foldMap
(Markdown -> Markdown
forall a. (Semigroup a, IsString a) => a -> a
toListItem (Markdown -> Markdown)
-> (ConstructorRep a -> Markdown) -> ConstructorRep a -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithinParens -> ConstructorRep a -> Markdown
renderNamedProduct (Bool -> WithinParens
WithinParens Bool
True)) (ADTRep a -> [Element (ADTRep a)]
forall t. Container t => t -> [Element t]
toList ADTRep a
ps)
where
toListItem :: a -> a
toListItem a
item = a
"+ " a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
item a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
"\n"
renderNamedProduct :: WithinParens -> ConstructorRep a -> Markdown
renderNamedProduct :: WithinParens -> ConstructorRep a -> Markdown
renderNamedProduct WithinParens
wp ctor :: ConstructorRep a
ctor@ConstructorRep{[FieldRep a]
Maybe Text
Text
crFields :: [FieldRep a]
crDescription :: Maybe Text
crName :: Text
crFields :: forall a. ConstructorRep a -> [FieldRep a]
crDescription :: forall a. ConstructorRep a -> Maybe Text
crName :: forall a. ConstructorRep a -> Text
..} =
Markdown -> Markdown
mdBold (Text -> Markdown
forall p. Buildable p => p -> Markdown
build Text
crName) Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<>
if Bool
hasFieldNames
then Markdown -> (Text -> Markdown) -> Maybe Text -> Markdown
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Markdown
"" (\Text
d -> Markdown
": " Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Text -> Markdown
forall p. Buildable p => p -> Markdown
build Text
d Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
" ") Maybe Text
crDescription Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<>
WithinParens -> ConstructorRep a -> [FieldRep a] -> Markdown
renderProduct WithinParens
wp ConstructorRep a
ctor [FieldRep a]
crFields
else WithinParens -> ConstructorRep a -> [FieldRep a] -> Markdown
renderProduct WithinParens
wp ConstructorRep a
ctor [FieldRep a]
crFields Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<>
Markdown -> (Text -> Markdown) -> Maybe Text -> Markdown
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Markdown
"" (\Text
d -> Markdown
": " Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Text -> Markdown
forall p. Buildable p => p -> Markdown
build Text
d) Maybe Text
crDescription
where
hasFieldNames :: Bool
hasFieldNames = (Element [FieldRep a] -> Bool) -> [FieldRep a] -> Bool
forall t. Container t => (Element t -> Bool) -> t -> Bool
any (Maybe Text -> Bool
forall a. Maybe a -> Bool
isJust (Maybe Text -> Bool)
-> (FieldRep a -> Maybe Text) -> FieldRep a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldRep a -> Maybe Text
forall a. FieldRep a -> Maybe Text
frName) [FieldRep a]
crFields
renderProduct :: WithinParens -> ConstructorRep a -> [FieldRep a] -> Markdown
renderProduct :: WithinParens -> ConstructorRep a -> [FieldRep a] -> Markdown
renderProduct WithinParens
wp ConstructorRep a
ctor = \case
[] -> Markdown
"()"
[t :: FieldRep a
t@FieldRep{ frDescription :: forall a. FieldRep a -> Maybe Text
frDescription = Maybe Text
Nothing }]
| Maybe Text
Nothing <- ConstructorRep a -> Maybe Text
forall a. ConstructorRep a -> Maybe Text
crDescription ConstructorRep a
ctor -> WithinParens -> FieldRep a -> Markdown
renderNamedField WithinParens
wp FieldRep a
t
[FieldRep a]
ts -> [Markdown] -> Markdown
forall a. Monoid a => [a] -> a
mconcat ([Markdown] -> Markdown) -> [Markdown] -> Markdown
forall a b. (a -> b) -> a -> b
$ (FieldRep a -> Markdown) -> [FieldRep a] -> [Markdown]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map ((Markdown
"\n * " Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<>) (Markdown -> Markdown)
-> (FieldRep a -> Markdown) -> FieldRep a -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithinParens -> FieldRep a -> Markdown
renderNamedField WithinParens
wp) [FieldRep a]
ts
renderNamedField :: WithinParens -> FieldRep a -> Markdown
renderNamedField :: WithinParens -> FieldRep a -> Markdown
renderNamedField WithinParens
wp FieldRep{a
Maybe Text
frTypeRep :: a
frDescription :: Maybe Text
frName :: Maybe Text
frTypeRep :: forall a. FieldRep a -> a
frDescription :: forall a. FieldRep a -> Maybe Text
frName :: forall a. FieldRep a -> Maybe Text
..} = [Markdown] -> Markdown
forall a. Monoid a => [a] -> a
mconcat
[ Markdown -> (Text -> Markdown) -> Maybe Text -> Markdown
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Markdown
"" Text -> Markdown
buildFieldName Maybe Text
frName
, WithinParens -> a -> Markdown
buildField WithinParens
wp a
frTypeRep
, Markdown -> (Text -> Markdown) -> Maybe Text -> Markdown
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Markdown
"" (Markdown -> Markdown -> Markdown
forall a. Monoid a => a -> a -> a
mappend Markdown
" " (Markdown -> Markdown) -> (Text -> Markdown) -> Text -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Markdown -> Markdown -> Markdown
forall a. Monoid a => a -> a -> a
mappend Markdown
"\n" (Markdown -> Markdown) -> (Text -> Markdown) -> Text -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Markdown
forall p. Buildable p => p -> Markdown
build) Maybe Text
frDescription
]
mapADTRepFields :: (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields :: (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields = ASetter (ADTRep a) (ADTRep a) (Maybe Text) (Maybe Text)
-> (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over (ASetter (ADTRep a) (ADTRep a) (Maybe Text) (Maybe Text)
-> (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a)
-> ASetter (ADTRep a) (ADTRep a) (Maybe Text) (Maybe Text)
-> (Maybe Text -> Maybe Text)
-> ADTRep a
-> ADTRep a
forall a b. (a -> b) -> a -> b
$ (ConstructorRep a -> Identity (ConstructorRep a))
-> ADTRep a -> Identity (ADTRep a)
forall s t a b. Each s t a b => Traversal s t a b
each ((ConstructorRep a -> Identity (ConstructorRep a))
-> ADTRep a -> Identity (ADTRep a))
-> ((Maybe Text -> Identity (Maybe Text))
-> ConstructorRep a -> Identity (ConstructorRep a))
-> ASetter (ADTRep a) (ADTRep a) (Maybe Text) (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([FieldRep a] -> Identity [FieldRep a])
-> ConstructorRep a -> Identity (ConstructorRep a)
forall a a.
Lens
(ConstructorRep a) (ConstructorRep a) [FieldRep a] [FieldRep a]
crFieldsL (([FieldRep a] -> Identity [FieldRep a])
-> ConstructorRep a -> Identity (ConstructorRep a))
-> ((Maybe Text -> Identity (Maybe Text))
-> [FieldRep a] -> Identity [FieldRep a])
-> (Maybe Text -> Identity (Maybe Text))
-> ConstructorRep a
-> Identity (ConstructorRep a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FieldRep a -> Identity (FieldRep a))
-> [FieldRep a] -> Identity [FieldRep a]
forall s t a b. Each s t a b => Traversal s t a b
each ((FieldRep a -> Identity (FieldRep a))
-> [FieldRep a] -> Identity [FieldRep a])
-> ((Maybe Text -> Identity (Maybe Text))
-> FieldRep a -> Identity (FieldRep a))
-> (Maybe Text -> Identity (Maybe Text))
-> [FieldRep a]
-> Identity [FieldRep a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe Text -> Identity (Maybe Text))
-> FieldRep a -> Identity (FieldRep a)
forall a. Lens' (FieldRep a) (Maybe Text)
frNameL
buildFieldName :: Text -> Markdown
buildFieldName :: Text -> Markdown
buildFieldName Text
name = Markdown -> Markdown
mdItalic (Markdown -> Markdown
mdBold (Text -> Markdown
forall p. Buildable p => p -> Markdown
build Text
name)) Markdown -> Markdown -> Markdown
forall a b. (Buildable a, FromBuilder b) => a -> Markdown -> b
|+ Markdown
" :"
newtype WithinParens = WithinParens Bool
applyWithinParens :: WithinParens -> Markdown -> Markdown
applyWithinParens :: WithinParens -> Markdown -> Markdown
applyWithinParens (WithinParens Bool
wp) Markdown
txt
| Bool
wp = Markdown
"(" Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
txt Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
")"
| Bool
otherwise = Markdown
txt
buildTypeWithinParens :: forall a. Typeable a => WithinParens -> Markdown
buildTypeWithinParens :: WithinParens -> Markdown
buildTypeWithinParens WithinParens
wp =
let rep :: TypeRep
rep = Proxy a -> TypeRep
forall k (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> TypeRep
typeRep (Proxy a
forall k (t :: k). Proxy t
Proxy @a)
wrap :: Markdown -> Markdown
wrap = if [TypeRep] -> Bool
forall t. Container t => t -> Bool
null (TypeRep -> [TypeRep]
typeRepArgs TypeRep
rep) then Markdown -> Markdown
forall a. a -> a
id else WithinParens -> Markdown -> Markdown
applyWithinParens WithinParens
wp
in Markdown -> Markdown
wrap (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$ Buildable Text => Text -> Markdown
forall p. Buildable p => p -> Markdown
build @Text (Text -> Markdown) -> Text -> Markdown
forall a b. (a -> b) -> a -> b
$ TypeRep -> Text
forall b a. (Show a, IsString b) => a -> b
show TypeRep
rep
class ( Typeable a
, SingI (TypeDocFieldDescriptions a)
, FieldDescriptionsValid (TypeDocFieldDescriptions a) a
) => TypeHasDoc a where
typeDocName :: Proxy a -> Text
default typeDocName
:: (Generic a, KnownSymbol (GenericTypeName a))
=> Proxy a -> Text
typeDocName Proxy a
_ = String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ Proxy (GTypeName (Rep a)) -> String
forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (Proxy (GTypeName (Rep a))
forall k (t :: k). Proxy t
Proxy @(GenericTypeName a))
typeDocMdDescription :: Markdown
typeDocMdReference :: Proxy a -> WithinParens -> Markdown
default typeDocMdReference
:: (Typeable a, IsHomomorphic a)
=> Proxy a -> WithinParens -> Markdown
typeDocMdReference = Proxy a -> WithinParens -> Markdown
forall t.
(Typeable t, TypeHasDoc t, IsHomomorphic t) =>
Proxy t -> WithinParens -> Markdown
homomorphicTypeDocMdReference
typeDocDependencies :: Proxy a -> [SomeDocDefinitionItem]
default typeDocDependencies
:: (Generic a, GTypeHasDoc (G.Rep a))
=> Proxy a -> [SomeDocDefinitionItem]
typeDocDependencies = Proxy a -> [SomeDocDefinitionItem]
forall a.
(Generic a, GTypeHasDoc (Rep a)) =>
Proxy a -> [SomeDocDefinitionItem]
genericTypeDocDependencies
typeDocHaskellRep :: TypeDocHaskellRep a
default typeDocHaskellRep
:: (Generic a, GTypeHasDoc (G.Rep a), IsHomomorphic a)
=> TypeDocHaskellRep a
typeDocHaskellRep = TypeDocHaskellRep a -> TypeDocHaskellRep a
forall a.
HasCallStack =>
TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellRepStripFieldPrefix TypeDocHaskellRep a
forall a. (Generic a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep a
homomorphicTypeDocHaskellRep
type TypeDocFieldDescriptions a :: FieldDescriptions
type TypeDocFieldDescriptions _ = '[]
typeDocMichelsonRep :: TypeDocMichelsonRep a
default typeDocMichelsonRep
:: (KnownIsoT a, IsHomomorphic a)
=> TypeDocMichelsonRep a
typeDocMichelsonRep = TypeDocMichelsonRep a
forall a. KnownIsoT a => TypeDocMichelsonRep a
homomorphicTypeDocMichelsonRep
type TypeDocHaskellRep a =
Proxy a -> FieldDescriptionsV -> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
type TypeDocMichelsonRep a =
Proxy a -> (Maybe DocTypeRepLHS, T)
data SomeTypeWithDoc where
SomeTypeWithDoc :: TypeHasDoc td => Proxy td -> SomeTypeWithDoc
newtype DocTypeRepLHS = DocTypeRepLHS Text
deriving newtype (String -> DocTypeRepLHS
(String -> DocTypeRepLHS) -> IsString DocTypeRepLHS
forall a. (String -> a) -> IsString a
fromString :: String -> DocTypeRepLHS
$cfromString :: String -> DocTypeRepLHS
IsString, DocTypeRepLHS -> Markdown
(DocTypeRepLHS -> Markdown) -> Buildable DocTypeRepLHS
forall p. (p -> Markdown) -> Buildable p
build :: DocTypeRepLHS -> Markdown
$cbuild :: DocTypeRepLHS -> Markdown
Buildable)
data DType where
DType :: TypeHasDoc a => Proxy a -> DType
instance Show DType where
show :: DType -> String
show (DType Proxy a
a) = TypeRep -> String
forall b a. (Show a, IsString b) => a -> b
show (TypeRep -> String) -> TypeRep -> String
forall a b. (a -> b) -> a -> b
$ Proxy a -> TypeRep
forall k (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> TypeRep
typeRep Proxy a
a
instance Eq DType where
DType Proxy a
a1 == :: DType -> DType -> Bool
== DType Proxy a
a2 = Proxy a
a1 Proxy a -> Proxy a -> Bool
forall a1 a2. (Typeable a1, Typeable a2, Eq a1) => a1 -> a2 -> Bool
`eqExt` Proxy a
a2
instance Ord DType where
DType Proxy a
a1 compare :: DType -> DType -> Ordering
`compare` DType Proxy a
a2 = Proxy a
a1 Proxy a -> Proxy a -> Ordering
forall a1 a2.
(Typeable a1, Typeable a2, Ord a1) =>
a1 -> a2 -> Ordering
`compareExt` Proxy a
a2
instance DocItem DType where
type DocItemPlacement DType = 'DocItemInDefinitions
type DocItemReferenced DType = 'True
docItemPos :: Natural
docItemPos = Natural
5000
docItemSectionName :: Maybe Text
docItemSectionName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"Types"
docItemRef :: DType
-> DocItemRef (DocItemPlacement DType) (DocItemReferenced DType)
docItemRef (DType Proxy a
a) = DocItemId -> DocItemRef 'DocItemInDefinitions 'True
DocItemRef (DocItemId -> DocItemRef 'DocItemInDefinitions 'True)
-> DocItemId -> DocItemRef 'DocItemInDefinitions 'True
forall a b. (a -> b) -> a -> b
$
Text -> DocItemId
DocItemId (Text
"types-" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Proxy a -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy a
a)
docItemDependencies :: DType -> [SomeDocDefinitionItem]
docItemDependencies (DType (Proxy a
ap' :: Proxy a)) =
Proxy a -> [SomeDocDefinitionItem]
forall a. TypeHasDoc a => Proxy a -> [SomeDocDefinitionItem]
typeDocDependencies Proxy a
ap'
docItemToMarkdown :: HeaderLevel -> DType -> Markdown
docItemToMarkdown HeaderLevel
lvl (DType (Proxy a
ap' :: Proxy a)) =
[Markdown] -> Markdown
forall a. Monoid a => [a] -> a
mconcat ([Markdown] -> Markdown)
-> ([Maybe Markdown] -> [Markdown]) -> [Maybe Markdown] -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Maybe Markdown] -> [Markdown]
forall a. [Maybe a] -> [a]
catMaybes ([Maybe Markdown] -> Markdown) -> [Maybe Markdown] -> Markdown
forall a b. (a -> b) -> a -> b
$
[ Markdown -> Maybe Markdown
forall a. a -> Maybe a
Just Markdown
mdSeparator
, Markdown -> Maybe Markdown
forall a. a -> Maybe a
Just (Markdown -> Maybe Markdown) -> Markdown -> Maybe Markdown
forall a b. (a -> b) -> a -> b
$ HeaderLevel -> Markdown -> Markdown
mdHeader HeaderLevel
lvl (Markdown -> Markdown
mdTicked (Markdown -> Markdown) -> (Text -> Markdown) -> Text -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Markdown
forall p. Buildable p => p -> Markdown
build (Text -> Markdown) -> Text -> Markdown
forall a b. (a -> b) -> a -> b
$ Proxy a -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy a
ap')
, Markdown -> Maybe Markdown
forall a. a -> Maybe a
Just (Markdown -> Maybe Markdown) -> Markdown -> Maybe Markdown
forall a b. (a -> b) -> a -> b
$ TypeHasDoc a => Markdown
forall a. TypeHasDoc a => Markdown
typeDocMdDescription @a Markdown -> Markdown -> Markdown
forall a b. (Buildable a, FromBuilder b) => a -> Markdown -> b
|+ Markdown
"\n\n"
, TypeDocHaskellRep a
forall a. TypeHasDoc a => TypeDocHaskellRep a
typeDocHaskellRep Proxy a
ap' ((SingKind (KindOf (TypeDocFieldDescriptions a)),
SingI (TypeDocFieldDescriptions a)) =>
Demote (KindOf (TypeDocFieldDescriptions a))
forall k (a :: k). (SingKind k, SingI a) => Demote k
demote @(TypeDocFieldDescriptions a)) Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> ((Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc) -> Markdown)
-> Maybe Markdown
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(Maybe DocTypeRepLHS
mlhs, ADTRep SomeTypeWithDoc
rep) ->
let
buildField :: WithinParens -> SomeTypeWithDoc -> Markdown
buildField :: WithinParens -> SomeTypeWithDoc -> Markdown
buildField WithinParens
wp (SomeTypeWithDoc Proxy td
di) =
Proxy td -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference Proxy td
di WithinParens
wp
renderedRep :: Markdown
renderedRep =
(WithinParens -> SomeTypeWithDoc -> Markdown)
-> ADTRep SomeTypeWithDoc -> Markdown
forall a. (WithinParens -> a -> Markdown) -> ADTRep a -> Markdown
buildADTRep WithinParens -> SomeTypeWithDoc -> Markdown
buildField ADTRep SomeTypeWithDoc
rep
rendered :: Markdown
rendered = case Maybe DocTypeRepLHS
mlhs of
Maybe DocTypeRepLHS
Nothing ->
Markdown -> Markdown -> Markdown
mdSubsection Markdown
"Structure" Markdown
renderedRep
Just DocTypeRepLHS
lhs ->
Markdown -> Markdown -> Markdown
mdSubsection Markdown
"Structure (example)" (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$
Markdown -> Markdown
mdTicked (DocTypeRepLHS -> Markdown
forall p. Buildable p => p -> Markdown
build DocTypeRepLHS
lhs) Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
" = " Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
renderedRep
in Markdown
rendered Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
"\n\n"
, Markdown -> Maybe Markdown
forall a. a -> Maybe a
Just (Markdown -> Maybe Markdown) -> Markdown -> Maybe Markdown
forall a b. (a -> b) -> a -> b
$
Proxy a -> Markdown
forall a. TypeHasDoc a => Proxy a -> Markdown
typeDocBuiltMichelsonRep (Proxy a
forall k (t :: k). Proxy t
Proxy @a) Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
"\n\n"
]
docItemToToc :: HeaderLevel -> DType -> Markdown
docItemToToc HeaderLevel
lvl d :: DType
d@(DType Proxy a
ap') =
HeaderLevel -> Markdown -> DType -> Markdown
forall d.
(DocItem d, DocItemReferenced d ~ 'True) =>
HeaderLevel -> Markdown -> d -> Markdown
mdTocFromRef HeaderLevel
lvl (Text -> Markdown
forall p. Buildable p => p -> Markdown
build (Text -> Markdown) -> Text -> Markdown
forall a b. (a -> b) -> a -> b
$ Proxy a -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy a
ap') DType
d
typeDocBuiltMichelsonRep :: TypeHasDoc a => Proxy a -> Builder
typeDocBuiltMichelsonRep :: Proxy a -> Markdown
typeDocBuiltMichelsonRep Proxy a
ap' =
let (Maybe DocTypeRepLHS
mlhs, T
rep) = TypeDocMichelsonRep a
forall a. TypeHasDoc a => TypeDocMichelsonRep a
typeDocMichelsonRep Proxy a
ap'
renderedRep :: Markdown
renderedRep = Markdown -> Markdown
mdTicked (T -> Markdown
forall p. Buildable p => p -> Markdown
build T
rep)
in case Maybe DocTypeRepLHS
mlhs of
Maybe DocTypeRepLHS
Nothing ->
Markdown -> Markdown -> Markdown
mdSubsection Markdown
"Final Michelson representation"
Markdown
renderedRep
Just DocTypeRepLHS
lhs ->
Markdown -> Markdown -> Markdown
mdSubsection Markdown
"Final Michelson representation (example)" (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$
Markdown -> Markdown
mdTicked (DocTypeRepLHS -> Markdown
forall p. Buildable p => p -> Markdown
build DocTypeRepLHS
lhs) Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
" = " Markdown -> Markdown -> Markdown
forall a. Semigroup a => a -> a -> a
<> Markdown
renderedRep
dTypeDep :: forall (t :: Type). TypeHasDoc t => SomeDocDefinitionItem
dTypeDep :: SomeDocDefinitionItem
dTypeDep = DType -> SomeDocDefinitionItem
forall d.
(DocItem d, DocItemPlacement d ~ 'DocItemInDefinitions) =>
d -> SomeDocDefinitionItem
SomeDocDefinitionItem (Proxy t -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy t
forall k (t :: k). Proxy t
Proxy @t))
dTypeDepP
:: forall (t :: Type).
TypeHasDoc t
=> Proxy t -> SomeDocDefinitionItem
dTypeDepP :: Proxy t -> SomeDocDefinitionItem
dTypeDepP Proxy t
_ = TypeHasDoc t => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @t
newtype DStorageType = DStorageType DType
deriving stock ((forall x. DStorageType -> Rep DStorageType x)
-> (forall x. Rep DStorageType x -> DStorageType)
-> Generic DStorageType
forall x. Rep DStorageType x -> DStorageType
forall x. DStorageType -> Rep DStorageType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DStorageType x -> DStorageType
$cfrom :: forall x. DStorageType -> Rep DStorageType x
Generic, DStorageType -> DStorageType -> Bool
(DStorageType -> DStorageType -> Bool)
-> (DStorageType -> DStorageType -> Bool) -> Eq DStorageType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DStorageType -> DStorageType -> Bool
$c/= :: DStorageType -> DStorageType -> Bool
== :: DStorageType -> DStorageType -> Bool
$c== :: DStorageType -> DStorageType -> Bool
Eq, Eq DStorageType
Eq DStorageType
-> (DStorageType -> DStorageType -> Ordering)
-> (DStorageType -> DStorageType -> Bool)
-> (DStorageType -> DStorageType -> Bool)
-> (DStorageType -> DStorageType -> Bool)
-> (DStorageType -> DStorageType -> Bool)
-> (DStorageType -> DStorageType -> DStorageType)
-> (DStorageType -> DStorageType -> DStorageType)
-> Ord DStorageType
DStorageType -> DStorageType -> Bool
DStorageType -> DStorageType -> Ordering
DStorageType -> DStorageType -> DStorageType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DStorageType -> DStorageType -> DStorageType
$cmin :: DStorageType -> DStorageType -> DStorageType
max :: DStorageType -> DStorageType -> DStorageType
$cmax :: DStorageType -> DStorageType -> DStorageType
>= :: DStorageType -> DStorageType -> Bool
$c>= :: DStorageType -> DStorageType -> Bool
> :: DStorageType -> DStorageType -> Bool
$c> :: DStorageType -> DStorageType -> Bool
<= :: DStorageType -> DStorageType -> Bool
$c<= :: DStorageType -> DStorageType -> Bool
< :: DStorageType -> DStorageType -> Bool
$c< :: DStorageType -> DStorageType -> Bool
compare :: DStorageType -> DStorageType -> Ordering
$ccompare :: DStorageType -> DStorageType -> Ordering
$cp1Ord :: Eq DStorageType
Ord)
dStorage :: forall store. TypeHasDoc store => DStorageType
dStorage :: DStorageType
dStorage = DType -> DStorageType
DStorageType (DType -> DStorageType) -> DType -> DStorageType
forall a b. (a -> b) -> a -> b
$ Proxy store -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy store
forall k (t :: k). Proxy t
Proxy @store)
instance DocItem DStorageType where
type DocItemPlacement DStorageType = 'DocItemInlined
type DocItemReferenced DStorageType = 'True
docItemRef :: DStorageType
-> DocItemRef
(DocItemPlacement DStorageType) (DocItemReferenced DStorageType)
docItemRef (DStorageType (DType Proxy a
a)) = DocItemId -> DocItemRef 'DocItemInlined 'True
DocItemRefInlined (DocItemId -> DocItemRef 'DocItemInlined 'True)
-> DocItemId -> DocItemRef 'DocItemInlined 'True
forall a b. (a -> b) -> a -> b
$
Text -> DocItemId
DocItemId (Text
"storage-" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Proxy a -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy a
a)
docItemPos :: Natural
docItemPos = Natural
835
docItemSectionName :: Maybe Text
docItemSectionName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"Storage"
docItemToMarkdown :: HeaderLevel -> DStorageType -> Markdown
docItemToMarkdown HeaderLevel
lvl (DStorageType DType
t) = HeaderLevel -> DType -> Markdown
forall d. DocItem d => HeaderLevel -> d -> Markdown
docItemToMarkdown HeaderLevel
lvl DType
t
docItemToToc :: HeaderLevel -> DStorageType -> Markdown
docItemToToc HeaderLevel
lvl d :: DStorageType
d@(DStorageType (DType Proxy a
a)) =
HeaderLevel -> Markdown -> DStorageType -> Markdown
forall d.
(DocItem d, DocItemReferenced d ~ 'True) =>
HeaderLevel -> Markdown -> d -> Markdown
mdTocFromRef HeaderLevel
lvl (Text -> Markdown
forall p. Buildable p => p -> Markdown
build (Text -> Markdown) -> Text -> Markdown
forall a b. (a -> b) -> a -> b
$ Proxy a -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy a
a) DStorageType
d
docItemDependencies :: DStorageType -> [SomeDocDefinitionItem]
docItemDependencies (DStorageType DType
t) = DType -> [SomeDocDefinitionItem]
forall d. DocItem d => d -> [SomeDocDefinitionItem]
docItemDependencies DType
t
class HaveCommonTypeCtor a b
instance HaveCommonTypeCtor ac bc => HaveCommonTypeCtor (ac a) (bc b)
instance HaveCommonTypeCtor a a
class IsHomomorphic a where
instance TypeError ('Text "Type is not homomorphic: " ':<>: 'ShowType (a b)) =>
IsHomomorphic (a b)
instance {-# OVERLAPPABLE #-} IsHomomorphic a
customTypeDocMdReference :: (Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference :: (Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference (Text, DType)
tyInfo [DType]
typeArgsDoc =
(Text, DType)
-> [WithinParens -> Markdown] -> WithinParens -> Markdown
customTypeDocMdReference'
(Text, DType)
tyInfo
([DType]
typeArgsDoc [DType]
-> (DType -> WithinParens -> Markdown)
-> [WithinParens -> Markdown]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(DType Proxy a
di) -> Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference Proxy a
di)
customTypeDocMdReference'
:: (Text, DType)
-> [WithinParens -> Markdown]
-> WithinParens
-> Markdown
customTypeDocMdReference' :: (Text, DType)
-> [WithinParens -> Markdown] -> WithinParens -> Markdown
customTypeDocMdReference' (Text
typeCtorName, DType
tyDoc) [WithinParens -> Markdown]
typeArgsPrinters WithinParens
wp =
let DocItemRef DocItemId
ctorDocItemId = DType
-> DocItemRef (DocItemPlacement DType) (DocItemReferenced DType)
forall d.
DocItem d =>
d -> DocItemRef (DocItemPlacement d) (DocItemReferenced d)
docItemRef DType
tyDoc
in WithinParens -> Markdown -> Markdown
applyWithinParens WithinParens
wpSmart (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$
[Markdown] -> Markdown
forall a. Monoid a => [a] -> a
mconcat ([Markdown] -> Markdown)
-> ([Markdown] -> [Markdown]) -> [Markdown] -> Markdown
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Markdown -> [Markdown] -> [Markdown]
forall a. a -> [a] -> [a]
intersperse Markdown
" " ([Markdown] -> Markdown) -> [Markdown] -> Markdown
forall a b. (a -> b) -> a -> b
$
( Markdown -> DocItemId -> Markdown
forall anchor. ToAnchor anchor => Markdown -> anchor -> Markdown
mdLocalRef (Markdown -> Markdown
mdTicked (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$ Text -> Markdown
forall p. Buildable p => p -> Markdown
build Text
typeCtorName) DocItemId
ctorDocItemId
Markdown -> [Markdown] -> [Markdown]
forall a. a -> [a] -> [a]
: ([WithinParens -> Markdown]
typeArgsPrinters [WithinParens -> Markdown]
-> ((WithinParens -> Markdown) -> Markdown) -> [Markdown]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \WithinParens -> Markdown
printer -> WithinParens -> Markdown
printer (Bool -> WithinParens
WithinParens Bool
True))
)
where
wpSmart :: WithinParens
wpSmart =
let WithinParens Bool
wp' = WithinParens
wp
in Bool -> WithinParens
WithinParens (Bool
wp' Bool -> Bool -> Bool
forall a. Boolean a => a -> a -> a
&& Bool -> Bool
not ([WithinParens -> Markdown] -> Bool
forall t. Container t => t -> Bool
null [WithinParens -> Markdown]
typeArgsPrinters))
homomorphicTypeDocMdReference
:: forall (t :: Type).
(Typeable t, TypeHasDoc t, IsHomomorphic t)
=> Proxy t -> WithinParens -> Markdown
homomorphicTypeDocMdReference :: Proxy t -> WithinParens -> Markdown
homomorphicTypeDocMdReference Proxy t
tp WithinParens
_ =
(Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference
(Proxy t -> Text
forall a. TypeHasDoc a => Proxy a -> Text
typeDocName Proxy t
tp, Proxy t -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType Proxy t
tp)
[]
(Bool -> WithinParens
WithinParens Bool
False)
poly1TypeDocMdReference
:: forall t (r :: Type) (a :: Type).
(r ~ t a, Typeable t, Each '[TypeHasDoc] [r, a], IsHomomorphic t)
=> Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference :: Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference Proxy r
tp =
(Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference
(String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ Proxy t -> String
forall k (a :: k) (proxy :: k -> *).
Showtype a =>
proxy a -> String
showtype (Proxy t
forall k (t :: k). Proxy t
Proxy @t), Proxy r -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType Proxy r
tp)
[Proxy a -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy a
forall k (t :: k). Proxy t
Proxy @a)]
poly2TypeDocMdReference
:: forall t (r :: Type) (a :: Type) (b :: Type).
(r ~ t a b, Typeable t, Each '[TypeHasDoc] [r, a, b], IsHomomorphic t)
=> Proxy r -> WithinParens -> Markdown
poly2TypeDocMdReference :: Proxy r -> WithinParens -> Markdown
poly2TypeDocMdReference Proxy r
tp =
(Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference
(String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ Proxy t -> String
forall k (a :: k) (proxy :: k -> *).
Showtype a =>
proxy a -> String
showtype (Proxy t
forall k (t :: k). Proxy t
Proxy @t), Proxy r -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType Proxy r
tp)
[ Proxy a -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy a
forall k (t :: k). Proxy t
Proxy @a)
, Proxy b -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy b
forall k (t :: k). Proxy t
Proxy @b)
]
genericTypeDocDependencies
:: forall a.
(Generic a, GTypeHasDoc (G.Rep a))
=> Proxy a -> [SomeDocDefinitionItem]
genericTypeDocDependencies :: Proxy a -> [SomeDocDefinitionItem]
genericTypeDocDependencies Proxy a
_ = do
ConstructorRep{[FieldRep SomeTypeWithDoc]
Maybe Text
Text
crFields :: [FieldRep SomeTypeWithDoc]
crDescription :: Maybe Text
crName :: Text
crFields :: forall a. ConstructorRep a -> [FieldRep a]
crDescription :: forall a. ConstructorRep a -> Maybe Text
crName :: forall a. ConstructorRep a -> Text
..} <- ADTRep SomeTypeWithDoc -> [Element (ADTRep SomeTypeWithDoc)]
forall t. Container t => t -> [Element t]
toList (ADTRep SomeTypeWithDoc -> [Element (ADTRep SomeTypeWithDoc)])
-> ADTRep SomeTypeWithDoc -> [Element (ADTRep SomeTypeWithDoc)]
forall a b. (a -> b) -> a -> b
$ Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @(G.Rep a) []
FieldRep{Maybe Text
SomeTypeWithDoc
frTypeRep :: SomeTypeWithDoc
frDescription :: Maybe Text
frName :: Maybe Text
frTypeRep :: forall a. FieldRep a -> a
frDescription :: forall a. FieldRep a -> Maybe Text
frName :: forall a. FieldRep a -> Maybe Text
..} <- [FieldRep SomeTypeWithDoc]
crFields
SomeTypeWithDoc Proxy td
ty <- SomeTypeWithDoc -> [SomeTypeWithDoc]
forall (f :: * -> *) a. Applicative f => a -> f a
pure SomeTypeWithDoc
frTypeRep
SomeDocDefinitionItem -> [SomeDocDefinitionItem]
forall (m :: * -> *) a. Monad m => a -> m a
return (Proxy td -> SomeDocDefinitionItem
forall t. TypeHasDoc t => Proxy t -> SomeDocDefinitionItem
dTypeDepP Proxy td
ty)
homomorphicTypeDocHaskellRep
:: forall a.
(Generic a, GTypeHasDoc (G.Rep a))
=> TypeDocHaskellRep a
homomorphicTypeDocHaskellRep :: TypeDocHaskellRep a
homomorphicTypeDocHaskellRep Proxy a
_ Demote (KindOf (TypeDocFieldDescriptions a))
descr = (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. a -> Maybe a
Just
( Maybe DocTypeRepLHS
forall a. Maybe a
Nothing
, Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @(G.Rep a) Demote (KindOf (TypeDocFieldDescriptions a))
descr
)
concreteTypeDocHaskellRep
:: forall a b.
( Typeable a, GenericIsoValue a, GTypeHasDoc (G.Rep a)
, HaveCommonTypeCtor b a
)
=> TypeDocHaskellRep b
concreteTypeDocHaskellRep :: TypeDocHaskellRep b
concreteTypeDocHaskellRep = forall b.
(Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) =>
TypeDocHaskellRep b
forall a b.
(Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) =>
TypeDocHaskellRep b
unsafeConcreteTypeDocHaskellRep @a
unsafeConcreteTypeDocHaskellRep
:: forall a b.
( Typeable a, GenericIsoValue a, GTypeHasDoc (G.Rep a)
)
=> TypeDocHaskellRep b
unsafeConcreteTypeDocHaskellRep :: TypeDocHaskellRep b
unsafeConcreteTypeDocHaskellRep Proxy b
_ Demote (KindOf (TypeDocFieldDescriptions a))
descr = (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. a -> Maybe a
Just
( DocTypeRepLHS -> Maybe DocTypeRepLHS
forall a. a -> Maybe a
Just (Text -> DocTypeRepLHS
DocTypeRepLHS (Text -> DocTypeRepLHS)
-> (Proxy a -> Text) -> Proxy a -> DocTypeRepLHS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> (Proxy a -> String) -> Proxy a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy a -> String
forall k (a :: k) (proxy :: k -> *).
Showtype a =>
proxy a -> String
showtype (Proxy a -> DocTypeRepLHS) -> Proxy a -> DocTypeRepLHS
forall a b. (a -> b) -> a -> b
$ Proxy a
forall k (t :: k). Proxy t
Proxy @a)
, Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @(G.Rep a) Demote (KindOf (TypeDocFieldDescriptions a))
descr
)
haskellRepNoFields :: TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellRepNoFields :: TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellRepNoFields TypeDocHaskellRep a
mkRep =
\Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr -> (ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second ((Maybe Text -> Maybe Text)
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a. (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields (Maybe Text -> Maybe Text -> Maybe Text
forall a b. a -> b -> a
const Maybe Text
forall a. Maybe a
Nothing)) ((Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc))
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeDocHaskellRep a
mkRep Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr
haskellAddNewtypeField :: Text -> TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellAddNewtypeField :: Text -> TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellAddNewtypeField Text
fieldName TypeDocHaskellRep a
mkRep =
\Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr -> (ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second ((Maybe Text -> Maybe Text)
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a. (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields (Maybe Text -> Maybe Text -> Maybe Text
forall a b. a -> b -> a
const (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
fieldName))) ((Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc))
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeDocHaskellRep a
mkRep Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr
haskellRepStripFieldPrefix
:: HasCallStack
=> TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellRepStripFieldPrefix :: TypeDocHaskellRep a -> TypeDocHaskellRep a
haskellRepStripFieldPrefix TypeDocHaskellRep a
mkRep =
\Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr -> (ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second ((Maybe Text -> Maybe Text)
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a. (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields ((Text -> Text) -> Maybe Text -> Maybe Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> Text
stripPrefix)) ((Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc))
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
-> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeDocHaskellRep a
mkRep Proxy a
p Demote (KindOf (TypeDocFieldDescriptions a))
descr
where
stripPrefix :: Text -> Text
stripPrefix Text
fieldName =
case Text -> Maybe (Char, Text)
T.uncons (Text -> Maybe (Char, Text)) -> Text -> Maybe (Char, Text)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.dropWhile Char -> Bool
isLower Text
fieldName of
Maybe (Char, Text)
Nothing -> Text -> Text
forall a. HasCallStack => Text -> a
error (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Text
"Field '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fieldName Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' has no prefix"
Just (Char
c, Text
cs) ->
let isAbbreviation :: Bool
isAbbreviation = case Text -> Maybe (Char, Text)
T.uncons Text
cs of
Just (Char
c2, Text
_)
| Char -> Bool
isUpper Char
c2 -> Bool
True
| Bool
otherwise -> Bool
False
Maybe (Char, Text)
Nothing -> Bool
False
in Char -> Text -> Text
T.cons (if Bool
isAbbreviation then Char
c else Char -> Char
toLower Char
c) Text
cs
homomorphicTypeDocMichelsonRep
:: forall a.
KnownIsoT a
=> TypeDocMichelsonRep a
homomorphicTypeDocMichelsonRep :: TypeDocMichelsonRep a
homomorphicTypeDocMichelsonRep Proxy a
_ =
( Maybe DocTypeRepLHS
forall a. Maybe a
Nothing
, (SingKind T, SingI (ToT a)) => Demote T
forall k (a :: k). (SingKind k, SingI a) => Demote k
demote @(ToT a)
)
concreteTypeDocMichelsonRep
:: forall a b.
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a)
=> TypeDocMichelsonRep b
concreteTypeDocMichelsonRep :: TypeDocMichelsonRep b
concreteTypeDocMichelsonRep Proxy b
_ =
( DocTypeRepLHS -> Maybe DocTypeRepLHS
forall a. a -> Maybe a
Just (Text -> DocTypeRepLHS
DocTypeRepLHS (Text -> DocTypeRepLHS)
-> (Proxy a -> Text) -> Proxy a -> DocTypeRepLHS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> (Proxy a -> String) -> Proxy a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy a -> String
forall k (a :: k) (proxy :: k -> *).
Showtype a =>
proxy a -> String
showtype (Proxy a -> DocTypeRepLHS) -> Proxy a -> DocTypeRepLHS
forall a b. (a -> b) -> a -> b
$ Proxy a
forall k (t :: k). Proxy t
Proxy @a)
, (SingKind T, SingI (ToT a)) => Demote T
forall k (a :: k). (SingKind k, SingI a) => Demote k
demote @(ToT a)
)
unsafeConcreteTypeDocMichelsonRep
:: forall a b.
(Typeable a, KnownIsoT a)
=> TypeDocMichelsonRep b
unsafeConcreteTypeDocMichelsonRep :: TypeDocMichelsonRep b
unsafeConcreteTypeDocMichelsonRep Proxy b
_ =
( DocTypeRepLHS -> Maybe DocTypeRepLHS
forall a. a -> Maybe a
Just (Text -> DocTypeRepLHS
DocTypeRepLHS (Text -> DocTypeRepLHS)
-> (Proxy a -> Text) -> Proxy a -> DocTypeRepLHS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> (Proxy a -> String) -> Proxy a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy a -> String
forall k (a :: k) (proxy :: k -> *).
Showtype a =>
proxy a -> String
showtype (Proxy a -> DocTypeRepLHS) -> Proxy a -> DocTypeRepLHS
forall a b. (a -> b) -> a -> b
$ Proxy a
forall k (t :: k). Proxy t
Proxy @a)
, (SingKind T, SingI (ToT a)) => Demote T
forall k (a :: k). (SingKind k, SingI a) => Demote k
demote @(ToT a)
)
class GTypeHasDoc (x :: Type -> Type) where
gTypeDocHaskellRep :: FieldDescriptionsV -> ADTRep SomeTypeWithDoc
instance GTypeHasDoc x => GTypeHasDoc (G.D1 ('G.MetaData _a _b _c 'False) x) where
gTypeDocHaskellRep :: Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep = GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @x
instance GTypeHasDoc x => GTypeHasDoc (G.D1 ('G.MetaData _a _b _c 'True) x) where
gTypeDocHaskellRep :: Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep Demote (KindOf (TypeDocFieldDescriptions a))
descr =
(Maybe Text -> Maybe Text)
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a. (Maybe Text -> Maybe Text) -> ADTRep a -> ADTRep a
mapADTRepFields (Maybe Text -> Maybe Text -> Maybe Text
forall a b. a -> b -> a
const Maybe Text
forall a. Maybe a
Nothing) (ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc)
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a b. (a -> b) -> a -> b
$ Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @x Demote (KindOf (TypeDocFieldDescriptions a))
descr
instance (GTypeHasDoc x, GTypeHasDoc y) => GTypeHasDoc (x :+: y) where
gTypeDocHaskellRep :: Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep Demote (KindOf (TypeDocFieldDescriptions a))
descr = Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @x Demote (KindOf (TypeDocFieldDescriptions a))
descr ADTRep SomeTypeWithDoc
-> ADTRep SomeTypeWithDoc -> ADTRep SomeTypeWithDoc
forall a. Semigroup a => a -> a -> a
<> Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
forall (x :: * -> *).
GTypeHasDoc x =>
Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep @y Demote (KindOf (TypeDocFieldDescriptions a))
descr
instance (GProductHasDoc x, KnownSymbol ctor) =>
GTypeHasDoc (G.C1 ('G.MetaCons ctor _1 _2) x) where
gTypeDocHaskellRep :: Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep Demote (KindOf (TypeDocFieldDescriptions a))
descr = OneItem (ADTRep SomeTypeWithDoc) -> ADTRep SomeTypeWithDoc
forall x. One x => OneItem x -> x
one (OneItem (ADTRep SomeTypeWithDoc) -> ADTRep SomeTypeWithDoc)
-> OneItem (ADTRep SomeTypeWithDoc) -> ADTRep SomeTypeWithDoc
forall a b. (a -> b) -> a -> b
$ ConstructorRep :: forall a. Text -> Maybe Text -> [FieldRep a] -> ConstructorRep a
ConstructorRep
{ crName :: Text
crName = Text
conName
, crDescription :: Maybe Text
crDescription = [(Text, (Maybe Text, [(Text, Text)]))]
Demote (KindOf (TypeDocFieldDescriptions a))
descr [(Text, (Maybe Text, [(Text, Text)]))]
-> Getting (First Text) [(Text, (Maybe Text, [(Text, Text)]))] Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
^? ([(Text, (Maybe Text, [(Text, Text)]))]
-> Maybe (Maybe Text, [(Text, Text)]))
-> Optic'
(->)
(Const (First Text))
[(Text, (Maybe Text, [(Text, Text)]))]
(Maybe (Maybe Text, [(Text, Text)]))
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (Text
-> [(Text, (Maybe Text, [(Text, Text)]))]
-> Maybe (Maybe Text, [(Text, Text)])
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Text
conName) Optic'
(->)
(Const (First Text))
[(Text, (Maybe Text, [(Text, Text)]))]
(Maybe (Maybe Text, [(Text, Text)]))
-> ((Text -> Const (First Text) Text)
-> Maybe (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe (Maybe Text, [(Text, Text)])))
-> Getting (First Text) [(Text, (Maybe Text, [(Text, Text)]))] Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)]))
-> Maybe (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe (Maybe Text, [(Text, Text)]))
forall a b. Prism (Maybe a) (Maybe b) a b
_Just (((Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)]))
-> Maybe (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe (Maybe Text, [(Text, Text)])))
-> ((Text -> Const (First Text) Text)
-> (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)]))
-> (Text -> Const (First Text) Text)
-> Maybe (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe (Maybe Text, [(Text, Text)]))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe Text -> Const (First Text) (Maybe Text))
-> (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)])
forall s t a b. Field1 s t a b => Lens s t a b
_1 ((Maybe Text -> Const (First Text) (Maybe Text))
-> (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)]))
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> (Text -> Const (First Text) Text)
-> (Maybe Text, [(Text, Text)])
-> Const (First Text) (Maybe Text, [(Text, Text)])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
_Just
, crFields :: [FieldRep SomeTypeWithDoc]
crFields = GProductHasDoc x => [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
forall (x :: * -> *).
GProductHasDoc x =>
[(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep @x ([(Text, Text)] -> [FieldRep SomeTypeWithDoc])
-> [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
forall a b. (a -> b) -> a -> b
$ [(Text, (Maybe Text, [(Text, Text)]))]
Demote (KindOf (TypeDocFieldDescriptions a))
descr [(Text, (Maybe Text, [(Text, Text)]))]
-> Getting
[(Text, Text)]
[(Text, (Maybe Text, [(Text, Text)]))]
[(Text, Text)]
-> [(Text, Text)]
forall s a. s -> Getting a s a -> a
^. ([(Text, (Maybe Text, [(Text, Text)]))]
-> Maybe (Maybe Text, [(Text, Text)]))
-> Optic'
(->)
(Const [(Text, Text)])
[(Text, (Maybe Text, [(Text, Text)]))]
(Maybe (Maybe Text, [(Text, Text)]))
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (Text
-> [(Text, (Maybe Text, [(Text, Text)]))]
-> Maybe (Maybe Text, [(Text, Text)])
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Text
conName) Optic'
(->)
(Const [(Text, Text)])
[(Text, (Maybe Text, [(Text, Text)]))]
(Maybe (Maybe Text, [(Text, Text)]))
-> (([(Text, Text)] -> Const [(Text, Text)] [(Text, Text)])
-> Maybe (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe (Maybe Text, [(Text, Text)])))
-> Getting
[(Text, Text)]
[(Text, (Maybe Text, [(Text, Text)]))]
[(Text, Text)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe Text, [(Text, Text)]))
-> Maybe (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe (Maybe Text, [(Text, Text)]))
forall a b. Prism (Maybe a) (Maybe b) a b
_Just (((Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe Text, [(Text, Text)]))
-> Maybe (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe (Maybe Text, [(Text, Text)])))
-> (([(Text, Text)] -> Const [(Text, Text)] [(Text, Text)])
-> (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe Text, [(Text, Text)]))
-> ([(Text, Text)] -> Const [(Text, Text)] [(Text, Text)])
-> Maybe (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe (Maybe Text, [(Text, Text)]))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([(Text, Text)] -> Const [(Text, Text)] [(Text, Text)])
-> (Maybe Text, [(Text, Text)])
-> Const [(Text, Text)] (Maybe Text, [(Text, Text)])
forall s t a b. Field2 s t a b => Lens s t a b
_2
}
where
conName :: Text
conName = String -> Text
forall a. ToText a => a -> Text
toText (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ Proxy ctor -> String
forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (Proxy ctor
forall k (t :: k). Proxy t
Proxy @ctor)
instance GTypeHasDoc G.V1 where
gTypeDocHaskellRep :: Demote (KindOf (TypeDocFieldDescriptions a))
-> ADTRep SomeTypeWithDoc
gTypeDocHaskellRep Demote (KindOf (TypeDocFieldDescriptions a))
_ = []
class GProductHasDoc (x :: Type -> Type) where
gProductDocHaskellRep :: [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
instance (GProductHasDoc x, GProductHasDoc y) => GProductHasDoc (x :*: y) where
gProductDocHaskellRep :: [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep [(Text, Text)]
descr = [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
forall (x :: * -> *).
GProductHasDoc x =>
[(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep @x [(Text, Text)]
descr [FieldRep SomeTypeWithDoc]
-> [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc]
forall a. Semigroup a => a -> a -> a
<> [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
forall (x :: * -> *).
GProductHasDoc x =>
[(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep @y [(Text, Text)]
descr
instance TypeHasDoc a =>
GProductHasDoc (G.S1 ('G.MetaSel 'Nothing _1 _2 _3) (G.Rec0 a)) where
gProductDocHaskellRep :: [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep [(Text, Text)]
_ = OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc]
forall x. One x => OneItem x -> x
one (OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc])
-> OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc]
forall a b. (a -> b) -> a -> b
$ FieldRep :: forall a. Maybe Text -> Maybe Text -> a -> FieldRep a
FieldRep
{ frName :: Maybe Text
frName = Maybe Text
forall a. Maybe a
Nothing
, frDescription :: Maybe Text
frDescription = Maybe Text
forall a. Maybe a
Nothing
, frTypeRep :: SomeTypeWithDoc
frTypeRep = Proxy a -> SomeTypeWithDoc
forall td. TypeHasDoc td => Proxy td -> SomeTypeWithDoc
SomeTypeWithDoc (Proxy a
forall k (t :: k). Proxy t
Proxy @a)
}
instance (TypeHasDoc a, KnownSymbol field) =>
GProductHasDoc (G.S1 ('G.MetaSel ('Just field) _1 _2 _3) (G.Rec0 a)) where
gProductDocHaskellRep :: [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep [(Text, Text)]
descr = OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc]
forall x. One x => OneItem x -> x
one (OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc])
-> OneItem [FieldRep SomeTypeWithDoc] -> [FieldRep SomeTypeWithDoc]
forall a b. (a -> b) -> a -> b
$ FieldRep :: forall a. Maybe Text -> Maybe Text -> a -> FieldRep a
FieldRep
{ frName :: Maybe Text
frName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
fieldName
, frDescription :: Maybe Text
frDescription = [(Text, Text)]
descr [(Text, Text)]
-> Getting (First Text) [(Text, Text)] Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
^? ([(Text, Text)] -> Maybe Text)
-> Optic' (->) (Const (First Text)) [(Text, Text)] (Maybe Text)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (Text -> [(Text, Text)] -> Maybe Text
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Text
fieldName) Optic' (->) (Const (First Text)) [(Text, Text)] (Maybe Text)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) [(Text, Text)] Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
_Just
, frTypeRep :: SomeTypeWithDoc
frTypeRep = Proxy a -> SomeTypeWithDoc
forall td. TypeHasDoc td => Proxy td -> SomeTypeWithDoc
SomeTypeWithDoc (Proxy a
forall k (t :: k). Proxy t
Proxy @a)
}
where
fieldName :: Text
fieldName = String -> Text
forall a. ToText a => a -> Text
toText (Proxy field -> String
forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (Proxy field -> String) -> Proxy field -> String
forall a b. (a -> b) -> a -> b
$ Proxy field
forall k (t :: k). Proxy t
Proxy @field)
instance GProductHasDoc G.U1 where
gProductDocHaskellRep :: [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
gProductDocHaskellRep = [(Text, Text)] -> [FieldRep SomeTypeWithDoc]
forall a. Monoid a => a
mempty
type PolyTypeHasDocC ts = Each '[TypeHasDoc] ts
type PolyCTypeHasDocC ts = Each '[TypeHasDoc] ts
instance TypeHasDoc Integer where
typeDocName :: Proxy Integer -> Text
typeDocName Proxy Integer
_ = Text
"Integer"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Signed number."
typeDocDependencies :: Proxy Integer -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Integer
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Integer
typeDocHaskellRep Proxy Integer
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Natural where
typeDocName :: Proxy Natural -> Text
typeDocName Proxy Natural
_ = Text
"Natural"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Unsigned number."
typeDocDependencies :: Proxy Natural -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Natural
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Natural
typeDocHaskellRep Proxy Natural
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc MText where
typeDocName :: Proxy MText -> Text
typeDocName Proxy MText
_ = Text
"Text"
typeDocMdReference :: Proxy MText -> WithinParens -> Markdown
typeDocMdReference Proxy MText
p = (Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference (Text
"Text", Proxy MText -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType Proxy MText
p) []
typeDocMdDescription :: Markdown
typeDocMdDescription =
Markdown
"Michelson string.\n\n\
\This has to contain only ASCII characters with codes from [32; 126] range; \
\additionally, newline feed character is allowed."
typeDocDependencies :: Proxy MText -> [SomeDocDefinitionItem]
typeDocDependencies Proxy MText
_ = []
typeDocHaskellRep :: TypeDocHaskellRep MText
typeDocHaskellRep Proxy MText
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Bool where
typeDocName :: Proxy Bool -> Text
typeDocName Proxy Bool
_ = Text
"Bool"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Bool primitive."
typeDocDependencies :: Proxy Bool -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Bool
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Bool
typeDocHaskellRep Proxy Bool
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc ByteString where
typeDocName :: Proxy ByteString -> Text
typeDocName Proxy ByteString
_ = Text
"ByteString"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Bytes primitive."
typeDocDependencies :: Proxy ByteString -> [SomeDocDefinitionItem]
typeDocDependencies Proxy ByteString
_ = []
typeDocHaskellRep :: TypeDocHaskellRep ByteString
typeDocHaskellRep Proxy ByteString
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Mutez where
typeDocName :: Proxy Mutez -> Text
typeDocName Proxy Mutez
_ = Text
"Mutez"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Mutez primitive."
typeDocDependencies :: Proxy Mutez -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Mutez
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Mutez
typeDocHaskellRep Proxy Mutez
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc KeyHash where
typeDocName :: Proxy KeyHash -> Text
typeDocName Proxy KeyHash
_ = Text
"KeyHash"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"KeyHash primitive."
typeDocDependencies :: Proxy KeyHash -> [SomeDocDefinitionItem]
typeDocDependencies Proxy KeyHash
_ = []
typeDocHaskellRep :: TypeDocHaskellRep KeyHash
typeDocHaskellRep Proxy KeyHash
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Timestamp where
typeDocName :: Proxy Timestamp -> Text
typeDocName Proxy Timestamp
_ = Text
"Timestamp"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Timestamp primitive."
typeDocDependencies :: Proxy Timestamp -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Timestamp
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Timestamp
typeDocHaskellRep Proxy Timestamp
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Address where
typeDocName :: Proxy Address -> Text
typeDocName Proxy Address
_ = Text
"Address"
typeDocMdDescription :: Markdown
typeDocMdDescription = [md|
Address primitive.
Unlike Michelson's `address`, it is assumed not to contain an entrypoint name,
even if it refers to a contract; this won't be checked, so passing an entrypoint
name may result in unexpected errors.
|]
typeDocDependencies :: Proxy Address -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Address
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Address
typeDocHaskellRep Proxy Address
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc EpAddress where
typeDocName :: Proxy EpAddress -> Text
typeDocName Proxy EpAddress
_ = Text
"EntrypointAddress"
typeDocMdDescription :: Markdown
typeDocMdDescription = [md|
Address primitive.
This exactly matches the Michelson's `address`, and can refer to a specific entrypoint.
|]
typeDocDependencies :: Proxy EpAddress -> [SomeDocDefinitionItem]
typeDocDependencies Proxy EpAddress
_ = []
typeDocHaskellRep :: TypeDocHaskellRep EpAddress
typeDocHaskellRep Proxy EpAddress
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc PublicKey where
typeDocName :: Proxy PublicKey -> Text
typeDocName Proxy PublicKey
_ = Text
"PublicKey"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"PublicKey primitive."
typeDocDependencies :: Proxy PublicKey -> [SomeDocDefinitionItem]
typeDocDependencies Proxy PublicKey
_ = []
typeDocHaskellRep :: TypeDocHaskellRep PublicKey
typeDocHaskellRep Proxy PublicKey
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc Signature where
typeDocName :: Proxy Signature -> Text
typeDocName Proxy Signature
_ = Text
"Signature"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Signature primitive."
typeDocDependencies :: Proxy Signature -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Signature
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Signature
typeDocHaskellRep Proxy Signature
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc ChainId where
typeDocName :: Proxy ChainId -> Text
typeDocName Proxy ChainId
_ = Text
"ChainId"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Identifier of the current chain."
typeDocDependencies :: Proxy ChainId -> [SomeDocDefinitionItem]
typeDocDependencies Proxy ChainId
_ = []
typeDocHaskellRep :: TypeDocHaskellRep ChainId
typeDocHaskellRep Proxy ChainId
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc () where
typeDocName :: Proxy () -> Text
typeDocName Proxy ()
_ = Text
"()"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Unit primitive."
typeDocDependencies :: Proxy () -> [SomeDocDefinitionItem]
typeDocDependencies Proxy ()
_ = []
instance TypeHasDoc Chest where
typeDocName :: Proxy Chest -> Text
typeDocName Proxy Chest
_ = Text
"Chest"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Timelock puzzle chest."
typeDocDependencies :: Proxy Chest -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Chest
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Chest
typeDocHaskellRep Proxy Chest
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance TypeHasDoc ChestKey where
typeDocName :: Proxy ChestKey -> Text
typeDocName Proxy ChestKey
_ = Text
"ChestKey"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Timelock puzzle chest key."
typeDocDependencies :: Proxy ChestKey -> [SomeDocDefinitionItem]
typeDocDependencies Proxy ChestKey
_ = []
typeDocHaskellRep :: TypeDocHaskellRep ChestKey
typeDocHaskellRep Proxy ChestKey
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
instance PolyTypeHasDocC '[a] => TypeHasDoc [a] where
typeDocName :: Proxy [a] -> Text
typeDocName Proxy [a]
_ = Text
"List"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"List primitive."
typeDocMdReference :: Proxy [a] -> WithinParens -> Markdown
typeDocMdReference Proxy [a]
_ =
(Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference (Text
"List", Proxy [a] -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy [a]
forall k (t :: k). Proxy t
Proxy @[a])) [Proxy a -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType (Proxy a
forall k (t :: k). Proxy t
Proxy @a)]
typeDocHaskellRep :: TypeDocHaskellRep [a]
typeDocHaskellRep Proxy [a]
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep [a]
typeDocMichelsonRep = forall b.
(Typeable [Integer], KnownIsoT [Integer],
HaveCommonTypeCtor b [Integer]) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @[Integer]
instance PolyTypeHasDocC '[a] => TypeHasDoc (Maybe a) where
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Option primitive."
typeDocMdReference :: Proxy (Maybe a) -> WithinParens -> Markdown
typeDocMdReference = Proxy (Maybe a) -> WithinParens -> Markdown
forall (t :: * -> *) r a.
(r ~ t a, Typeable t, Each '[TypeHasDoc] '[r, a],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference
typeDocHaskellRep :: TypeDocHaskellRep (Maybe a)
typeDocHaskellRep Proxy (Maybe a)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (Maybe a)
typeDocMichelsonRep = forall b.
(Typeable (Maybe Integer), KnownIsoT (Maybe Integer),
HaveCommonTypeCtor b (Maybe Integer)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Maybe Integer)
instance PolyTypeHasDocC [l, r] => TypeHasDoc (Either l r) where
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Or primitive."
typeDocMdReference :: Proxy (Either l r) -> WithinParens -> Markdown
typeDocMdReference = Proxy (Either l r) -> WithinParens -> Markdown
forall (t :: * -> * -> *) r a b.
(r ~ t a b, Typeable t, Each '[TypeHasDoc] '[r, a, b],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly2TypeDocMdReference
typeDocHaskellRep :: TypeDocHaskellRep (Either l r)
typeDocHaskellRep Proxy (Either l r)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (Either l r)
typeDocMichelsonRep = forall b.
(Typeable (Either Integer Natural),
KnownIsoT (Either Integer Natural),
HaveCommonTypeCtor b (Either Integer Natural)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Either Integer Natural)
instance PolyTypeHasDocC [a, b] => TypeHasDoc (a, b) where
typeDocName :: Proxy (a, b) -> Text
typeDocName Proxy (a, b)
_ = Text
"(a, b)"
typeDocMdReference :: Proxy (a, b) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Pair primitive."
typeDocHaskellRep :: TypeDocHaskellRep (a, b)
typeDocHaskellRep Proxy (a, b)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b)
typeDocMichelsonRep = forall b.
(Typeable (Integer, Natural), KnownIsoT (Integer, Natural),
HaveCommonTypeCtor b (Integer, Natural)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Integer, Natural)
instance PolyCTypeHasDocC '[a] => TypeHasDoc (Set a) where
typeDocName :: Proxy (Set a) -> Text
typeDocName Proxy (Set a)
_ = Text
"Set"
typeDocMdReference :: Proxy (Set a) -> WithinParens -> Markdown
typeDocMdReference = Proxy (Set a) -> WithinParens -> Markdown
forall (t :: * -> *) r a.
(r ~ t a, Typeable t, Each '[TypeHasDoc] '[r, a],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Set primitive."
typeDocDependencies :: Proxy (Set a) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (Set a)
_ = [TypeHasDoc a => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @a]
typeDocHaskellRep :: TypeDocHaskellRep (Set a)
typeDocHaskellRep Proxy (Set a)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (Set a)
typeDocMichelsonRep = forall b.
(Typeable (Set Integer), KnownIsoT (Set Integer),
HaveCommonTypeCtor b (Set Integer)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Set Integer)
instance TypeHasDoc Operation where
typeDocName :: Proxy Operation -> Text
typeDocName Proxy Operation
_ = Text
"Operation"
typeDocMdReference :: Proxy Operation -> WithinParens -> Markdown
typeDocMdReference Proxy Operation
tp = (Text, DType) -> [DType] -> WithinParens -> Markdown
customTypeDocMdReference (Text
"Operation", Proxy Operation -> DType
forall a. TypeHasDoc a => Proxy a -> DType
DType Proxy Operation
tp) []
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Operation primitive."
typeDocDependencies :: Proxy Operation -> [SomeDocDefinitionItem]
typeDocDependencies Proxy Operation
_ = []
typeDocHaskellRep :: TypeDocHaskellRep Operation
typeDocHaskellRep Proxy Operation
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep Operation
typeDocMichelsonRep = TypeDocMichelsonRep Operation
forall a. KnownIsoT a => TypeDocMichelsonRep a
homomorphicTypeDocMichelsonRep
instance PolyTypeHasDocC '[cp] => TypeHasDoc (ContractRef cp) where
typeDocName :: Proxy (ContractRef cp) -> Text
typeDocName Proxy (ContractRef cp)
_ = Text
"Contract"
typeDocMdReference :: Proxy (ContractRef cp) -> WithinParens -> Markdown
typeDocMdReference = Proxy (ContractRef cp) -> WithinParens -> Markdown
forall (t :: * -> *) r a.
(r ~ t a, Typeable t, Each '[TypeHasDoc] '[r, a],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Contract primitive with given type of parameter."
typeDocDependencies :: Proxy (ContractRef cp) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (ContractRef cp)
_ = [TypeHasDoc cp => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @cp, TypeHasDoc Integer => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @Integer]
typeDocHaskellRep :: TypeDocHaskellRep (ContractRef cp)
typeDocHaskellRep Proxy (ContractRef cp)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (ContractRef cp)
typeDocMichelsonRep = forall b.
(Typeable (ContractRef Integer), KnownIsoT (ContractRef Integer),
HaveCommonTypeCtor b (ContractRef Integer)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(ContractRef Integer)
instance PolyTypeHasDocC '[a] => TypeHasDoc (Ticket a) where
typeDocName :: Proxy (Ticket a) -> Text
typeDocName Proxy (Ticket a)
_ = Text
"Ticket"
typeDocMdReference :: Proxy (Ticket a) -> WithinParens -> Markdown
typeDocMdReference = Proxy (Ticket a) -> WithinParens -> Markdown
forall (t :: * -> *) r a.
(r ~ t a, Typeable t, Each '[TypeHasDoc] '[r, a],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly1TypeDocMdReference
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Ticket primitive."
typeDocDependencies :: Proxy (Ticket a) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (Ticket a)
_ = [TypeHasDoc a => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @a, TypeHasDoc MText => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @MText]
typeDocHaskellRep :: TypeDocHaskellRep (Ticket a)
typeDocHaskellRep Proxy (Ticket a)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (Ticket a)
typeDocMichelsonRep = forall b.
(Typeable (Ticket MText), KnownIsoT (Ticket MText),
HaveCommonTypeCtor b (Ticket MText)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Ticket MText)
instance (PolyCTypeHasDocC '[k], PolyTypeHasDocC '[v], Ord k) =>
TypeHasDoc (Map k v) where
typeDocName :: Proxy (Map k v) -> Text
typeDocName Proxy (Map k v)
_ = Text
"Map"
typeDocMdReference :: Proxy (Map k v) -> WithinParens -> Markdown
typeDocMdReference = Proxy (Map k v) -> WithinParens -> Markdown
forall (t :: * -> * -> *) r a b.
(r ~ t a b, Typeable t, Each '[TypeHasDoc] '[r, a, b],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly2TypeDocMdReference
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Map primitive."
typeDocDependencies :: Proxy (Map k v) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (Map k v)
_ =
[TypeHasDoc k => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @k, TypeHasDoc v => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @v]
typeDocHaskellRep :: TypeDocHaskellRep (Map k v)
typeDocHaskellRep Proxy (Map k v)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (Map k v)
typeDocMichelsonRep = forall b.
(Typeable (Map Integer Natural), KnownIsoT (Map Integer Natural),
HaveCommonTypeCtor b (Map Integer Natural)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Map Integer Natural)
instance (PolyCTypeHasDocC '[k], PolyTypeHasDocC '[v], Ord k) =>
TypeHasDoc (BigMap k v) where
typeDocName :: Proxy (BigMap k v) -> Text
typeDocName Proxy (BigMap k v)
_ = Text
"BigMap"
typeDocMdReference :: Proxy (BigMap k v) -> WithinParens -> Markdown
typeDocMdReference = Proxy (BigMap k v) -> WithinParens -> Markdown
forall (t :: * -> * -> *) r a b.
(r ~ t a b, Typeable t, Each '[TypeHasDoc] '[r, a, b],
IsHomomorphic t) =>
Proxy r -> WithinParens -> Markdown
poly2TypeDocMdReference
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"BigMap primitive."
typeDocDependencies :: Proxy (BigMap k v) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (BigMap k v)
_ =
[TypeHasDoc k => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @k, TypeHasDoc v => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @v]
typeDocHaskellRep :: TypeDocHaskellRep (BigMap k v)
typeDocHaskellRep Proxy (BigMap k v)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (BigMap k v)
typeDocMichelsonRep = forall b.
(Typeable (BigMap Integer Natural),
KnownIsoT (BigMap Integer Natural),
HaveCommonTypeCtor b (BigMap Integer Natural)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(BigMap Integer Natural)
tupleTypeDocReference :: [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference :: [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference [Markdown]
vs WithinParens
_ = Markdown
"(" Markdown -> Markdown -> Markdown
forall b. FromBuilder b => Markdown -> Markdown -> b
+| [Markdown] -> Markdown
forall a. Monoid a => [a] -> a
mconcat (Markdown -> [Markdown] -> [Markdown]
forall a. a -> [a] -> [a]
intersperse Markdown
", " ([Markdown] -> [Markdown]) -> [Markdown] -> [Markdown]
forall a b. (a -> b) -> a -> b
$ (Markdown -> Markdown) -> [Markdown] -> [Markdown]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
map Markdown -> Markdown
forall p. Buildable p => p -> Markdown
build [Markdown]
vs) Markdown -> Markdown -> Markdown
forall a b. (Buildable a, FromBuilder b) => a -> Markdown -> b
|+ Markdown
")"
instance PolyTypeHasDocC [a, b, c] => TypeHasDoc (a, b, c) where
typeDocName :: Proxy (a, b, c) -> Text
typeDocName Proxy (a, b, c)
_ = Text
"(a, b, c)"
typeDocMdReference :: Proxy (a, b, c) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b, c)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy c -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy c
forall k (t :: k). Proxy t
Proxy @c) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Tuple of size 3."
typeDocHaskellRep :: TypeDocHaskellRep (a, b, c)
typeDocHaskellRep Proxy (a, b, c)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c)
typeDocMichelsonRep = forall b.
(Typeable (Integer, Natural, MText),
KnownIsoT (Integer, Natural, MText),
HaveCommonTypeCtor b (Integer, Natural, MText)) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @(Integer, Natural, MText)
instance PolyTypeHasDocC [a, b, c, d] => TypeHasDoc (a, b, c, d) where
typeDocName :: Proxy (a, b, c, d) -> Text
typeDocName Proxy (a, b, c, d)
_ = Text
"(a, b, c, d)"
typeDocMdReference :: Proxy (a, b, c, d) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b, c, d)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy c -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy c
forall k (t :: k). Proxy t
Proxy @c) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy d -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy d
forall k (t :: k). Proxy t
Proxy @d) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Tuple of size 4."
typeDocHaskellRep :: TypeDocHaskellRep (a, b, c, d)
typeDocHaskellRep Proxy (a, b, c, d)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c, d)
typeDocMichelsonRep =
forall b.
(Typeable ((), (), (), ()), KnownIsoT ((), (), (), ()),
HaveCommonTypeCtor b ((), (), (), ())) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @((), (), (), ())
instance PolyTypeHasDocC [a, b, c, d, e] => TypeHasDoc (a, b, c, d, e) where
typeDocName :: Proxy (a, b, c, d, e) -> Text
typeDocName Proxy (a, b, c, d, e)
_ = Text
"(a, b, c, d, e)"
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Tuple of size 5."
typeDocMdReference :: Proxy (a, b, c, d, e) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b, c, d, e)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy c -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy c
forall k (t :: k). Proxy t
Proxy @c) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy d -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy d
forall k (t :: k). Proxy t
Proxy @d) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy e -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy e
forall k (t :: k). Proxy t
Proxy @e) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocHaskellRep :: TypeDocHaskellRep (a, b, c, d, e)
typeDocHaskellRep Proxy (a, b, c, d, e)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c, d, e)
typeDocMichelsonRep =
forall b.
(Typeable ((), (), (), (), ()), KnownIsoT ((), (), (), (), ()),
HaveCommonTypeCtor b ((), (), (), (), ())) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @((), (), (), (), ())
instance PolyTypeHasDocC [a, b, c, d, e, f] => TypeHasDoc (a, b, c, d, e, f) where
typeDocName :: Proxy (a, b, c, d, e, f) -> Text
typeDocName Proxy (a, b, c, d, e, f)
_ = Text
"(a, b, c, d, e, f)"
typeDocMdReference :: Proxy (a, b, c, d, e, f) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b, c, d, e, f)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy c -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy c
forall k (t :: k). Proxy t
Proxy @c) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy d -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy d
forall k (t :: k). Proxy t
Proxy @d) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy e -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy e
forall k (t :: k). Proxy t
Proxy @e) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy f -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy f
forall k (t :: k). Proxy t
Proxy @f) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Tuple of size 6."
typeDocHaskellRep :: TypeDocHaskellRep (a, b, c, d, e, f)
typeDocHaskellRep Proxy (a, b, c, d, e, f)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c, d, e, f)
typeDocMichelsonRep =
forall b.
(Typeable ((), (), (), (), (), ()),
KnownIsoT ((), (), (), (), (), ()),
HaveCommonTypeCtor b ((), (), (), (), (), ())) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @((), (), (), (), (), ())
instance PolyTypeHasDocC [a, b, c, d, e, f, g] => TypeHasDoc (a, b, c, d, e, f, g) where
typeDocName :: Proxy (a, b, c, d, e, f, g) -> Text
typeDocName Proxy (a, b, c, d, e, f, g)
_ = Text
"(a, b, c, d, e, f, g)"
typeDocMdReference :: Proxy (a, b, c, d, e, f, g) -> WithinParens -> Markdown
typeDocMdReference Proxy (a, b, c, d, e, f, g)
_ = [Markdown] -> WithinParens -> Markdown
tupleTypeDocReference
[ Proxy a -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy a
forall k (t :: k). Proxy t
Proxy @a) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy b -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy b
forall k (t :: k). Proxy t
Proxy @b) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy c -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy c
forall k (t :: k). Proxy t
Proxy @c) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy d -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy d
forall k (t :: k). Proxy t
Proxy @d) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy e -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy e
forall k (t :: k). Proxy t
Proxy @e) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy f -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy f
forall k (t :: k). Proxy t
Proxy @f) (Bool -> WithinParens
WithinParens Bool
False)
, Proxy g -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy g
forall k (t :: k). Proxy t
Proxy @g) (Bool -> WithinParens
WithinParens Bool
False)
]
typeDocMdDescription :: Markdown
typeDocMdDescription = Markdown
"Tuple of size 7."
typeDocHaskellRep :: TypeDocHaskellRep (a, b, c, d, e, f, g)
typeDocHaskellRep Proxy (a, b, c, d, e, f, g)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c, d, e, f, g)
typeDocMichelsonRep =
forall b.
(Typeable ((), (), (), (), (), (), ()),
KnownIsoT ((), (), (), (), (), (), ()),
HaveCommonTypeCtor b ((), (), (), (), (), (), ())) =>
TypeDocMichelsonRep b
forall k a (b :: k).
(Typeable a, KnownIsoT a, HaveCommonTypeCtor b a) =>
TypeDocMichelsonRep b
concreteTypeDocMichelsonRep @((), (), (), (), (), (), ())
instance ( TypeHasDoc (ApplyNamedFunctor f a)
, KnownSymbol n
, KnownIsoT (ApplyNamedFunctor f Integer)
, Typeable f, Typeable a
) =>
TypeHasDoc (NamedF f a n) where
typeDocName :: Proxy (NamedF f a n) -> Text
typeDocName Proxy (NamedF f a n)
_ = Text
"Named entry"
typeDocMdReference :: Proxy (NamedF f a n) -> WithinParens -> Markdown
typeDocMdReference Proxy (NamedF f a n)
_ WithinParens
wp =
WithinParens -> Markdown -> Markdown
applyWithinParens WithinParens
wp (Markdown -> Markdown) -> Markdown -> Markdown
forall a b. (a -> b) -> a -> b
$
Text -> Markdown
buildFieldName (String -> Text
forall a. ToText a => a -> Text
toText (Proxy n -> String
forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (Proxy n -> String) -> Proxy n -> String
forall a b. (a -> b) -> a -> b
$ Proxy n
forall k (t :: k). Proxy t
Proxy @n)) Markdown -> Markdown -> Markdown
forall b. FromBuilder b => Markdown -> Markdown -> b
+| Markdown
" " Markdown -> Markdown -> Markdown
forall b. FromBuilder b => Markdown -> Markdown -> b
+|
Proxy (ApplyNamedFunctor f a) -> WithinParens -> Markdown
forall a. TypeHasDoc a => Proxy a -> WithinParens -> Markdown
typeDocMdReference (Proxy (ApplyNamedFunctor f a)
forall k (t :: k). Proxy t
Proxy @(ApplyNamedFunctor f a)) (Bool -> WithinParens
WithinParens Bool
False) Markdown -> Markdown -> Markdown
forall a b. (Buildable a, FromBuilder b) => a -> Markdown -> b
|+ Markdown
""
typeDocDependencies :: Proxy (NamedF f a n) -> [SomeDocDefinitionItem]
typeDocDependencies Proxy (NamedF f a n)
_ =
[ TypeHasDoc (ApplyNamedFunctor f a) => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @(ApplyNamedFunctor f a)
, TypeHasDoc Integer => SomeDocDefinitionItem
forall t. TypeHasDoc t => SomeDocDefinitionItem
dTypeDep @Integer
]
typeDocHaskellRep :: TypeDocHaskellRep (NamedF f a n)
typeDocHaskellRep Proxy (NamedF f a n)
_ Demote (KindOf (TypeDocFieldDescriptions a))
_ = Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc)
forall a. Maybe a
Nothing
typeDocMichelsonRep :: TypeDocMichelsonRep (NamedF f a n)
typeDocMichelsonRep Proxy (NamedF f a n)
_ = (DocTypeRepLHS -> Maybe DocTypeRepLHS
forall a. a -> Maybe a
Just DocTypeRepLHS
"number: Integer", (SingKind T, KnownIsoT (ApplyNamedFunctor f Integer)) => Demote T
forall k (a :: k). (SingKind k, SingI a) => Demote k
demote @(ToT (ApplyNamedFunctor f Integer)))
typeDocMdDescription :: Markdown
typeDocMdDescription =
Markdown
"Some entries have names for clarity.\n\n\
\In resulting Michelson names may be mapped to annotations."