morley-1.12.0: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Michelson.Typed.Haskell

Description

Haskell-Michelson conversions.

Synopsis

Documentation

data Dict a where #

Values of type Dict p capture a dictionary for a constraint of type p.

e.g.

Dict :: Dict (Eq Int)

captures a dictionary that proves we have an:

instance Eq 'Int

Pattern matching on the Dict constructor will bring this instance into scope.

Constructors

Dict :: forall a. a => Dict a 

Instances

Instances details
HasDict a (Dict a) 
Instance details

Defined in Data.Constraint

Methods

evidence :: Dict a -> Dict a #

a :=> (Read (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: a :- Read (Dict a) #

a :=> (Monoid (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: a :- Monoid (Dict a) #

a :=> (Enum (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: a :- Enum (Dict a) #

a :=> (Bounded (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: a :- Bounded (Dict a) #

() :=> (Eq (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Eq (Dict a) #

() :=> (Ord (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Ord (Dict a) #

() :=> (Show (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Show (Dict a) #

() :=> (Semigroup (Dict a)) 
Instance details

Defined in Data.Constraint

Methods

ins :: () :- Semigroup (Dict a) #

a => Bounded (Dict a) 
Instance details

Defined in Data.Constraint

Methods

minBound :: Dict a #

maxBound :: Dict a #

a => Enum (Dict a) 
Instance details

Defined in Data.Constraint

Methods

succ :: Dict a -> Dict a #

pred :: Dict a -> Dict a #

toEnum :: Int -> Dict a #

fromEnum :: Dict a -> Int #

enumFrom :: Dict a -> [Dict a] #

enumFromThen :: Dict a -> Dict a -> [Dict a] #

enumFromTo :: Dict a -> Dict a -> [Dict a] #

enumFromThenTo :: Dict a -> Dict a -> Dict a -> [Dict a] #

Eq (Dict a) 
Instance details

Defined in Data.Constraint

Methods

(==) :: Dict a -> Dict a -> Bool #

(/=) :: Dict a -> Dict a -> Bool #

(Typeable p, p) => Data (Dict p) 
Instance details

Defined in Data.Constraint

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dict p -> c (Dict p) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Dict p) #

toConstr :: Dict p -> Constr #

dataTypeOf :: Dict p -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Dict p)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Dict p)) #

gmapT :: (forall b. Data b => b -> b) -> Dict p -> Dict p #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dict p -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dict p -> r #

gmapQ :: (forall d. Data d => d -> u) -> Dict p -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Dict p -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dict p -> m (Dict p) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dict p -> m (Dict p) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dict p -> m (Dict p) #

Ord (Dict a) 
Instance details

Defined in Data.Constraint

Methods

compare :: Dict a -> Dict a -> Ordering #

(<) :: Dict a -> Dict a -> Bool #

(<=) :: Dict a -> Dict a -> Bool #

(>) :: Dict a -> Dict a -> Bool #

(>=) :: Dict a -> Dict a -> Bool #

max :: Dict a -> Dict a -> Dict a #

min :: Dict a -> Dict a -> Dict a #

a => Read (Dict a) 
Instance details

Defined in Data.Constraint

Show (Dict a) 
Instance details

Defined in Data.Constraint

Methods

showsPrec :: Int -> Dict a -> ShowS #

show :: Dict a -> String #

showList :: [Dict a] -> ShowS #

Semigroup (Dict a) 
Instance details

Defined in Data.Constraint

Methods

(<>) :: Dict a -> Dict a -> Dict a #

sconcat :: NonEmpty (Dict a) -> Dict a #

stimes :: Integral b => b -> Dict a -> Dict a #

a => Monoid (Dict a) 
Instance details

Defined in Data.Constraint

Methods

mempty :: Dict a #

mappend :: Dict a -> Dict a -> Dict a #

mconcat :: [Dict a] -> Dict a #

NFData (Dict c) 
Instance details

Defined in Data.Constraint

Methods

rnf :: Dict c -> () #

type Path = [Branch] Source #

Path to a leaf (some field or constructor) in generic tree representation.

data Branch Source #

Which branch to choose in generic tree representation: left, straight or right. S is used when there is one constructor with one field (something newtype-like).

The reason why we need S can be explained by this example: data A = A1 B | A2 Integer data B = B Bool Now we may search for A1 constructor or B constructor. Without S in both cases path will be the same ([L]).

Constructors

L 
S 
R 

type FieldDescriptions = [(Symbol, (Maybe Symbol, [(Symbol, Symbol)]))] Source #

Description of constructors and fields of some datatype.

This type is just two nested maps represented as associative lists. It is supposed to be interpreted like this:

[(Constructor name, (Maybe constructor description, [(Field name, Field description)]))]

Example with a concrete data type:

data Foo
  = Foo
      { fFoo :: Int
      }
  | Bar
      { fBar :: Text
      }
  deriving (Generic)

type FooDescriptions =
  '[ '( "Foo", '( 'Just "foo constructor",
      , '[ '("fFoo", "some number")
         ])
      )
   , '( "Bar", '( 'Nothing,
      , '[ '("fBar", "some string")
         ])
      )
   ]

class (Typeable t, SingI t) => KnownT (t :: T) Source #

Typeable + SingI constraints.

This restricts a type to be a constructible type of T kind.

Instances

Instances details
(Typeable t, SingI t) => KnownT t Source # 
Instance details

Defined in Michelson.Typed.Sing

KnownT t => CheckScope (StorageScope t) Source # 
Instance details

Defined in Michelson.Typed.Scope

KnownT t => CheckScope (ParameterScope t) Source # 
Instance details

Defined in Michelson.Typed.Scope

KnownT t => CheckScope (ComparabilityScope t) Source # 
Instance details

Defined in Michelson.Typed.Value

ligoLayout :: GenericStrategy Source #

Default layout in LIGO.

To be used with customGeneric, see this method for more info.

This is similar to leftBalanced, but

  • fields are sorted alphabetically;
  • always puts as large complete binary subtrees as possible at left.

ligoCombLayout :: GenericStrategy Source #

Comb layout in LIGO ( [@layout:comb] ).

To be used with customGeneric.

class (KnownT t, WellTypedSuperC t) => WellTyped (t :: T) Source #

This class encodes Michelson rules w.r.t where it requires comparable types. Earlier we had a dedicated type for representing comparable types CT. But then we integreated those types into T. This meant that some of the types that could be formed with various combinations of T would be illegal as per Michelson typing rule. Using this class, we inductively enforce that a type and all types it contains are well typed as per Michelson's rules.

Instances

Instances details
WellTyped 'TKey Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TKey

WellTyped 'TUnit Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TUnit

WellTyped 'TSignature Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TSignature

WellTyped 'TChainId Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TChainId

WellTyped 'TOperation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TOperation

WellTyped 'TInt Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TInt

WellTyped 'TNat Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TNat

WellTyped 'TString Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TString

WellTyped 'TBytes Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TBytes

WellTyped 'TMutez Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TMutez

WellTyped 'TBool Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TBool

WellTyped 'TKeyHash Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TKeyHash

WellTyped 'TTimestamp Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TTimestamp

WellTyped 'TAddress Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC 'TAddress

WellTyped t => WellTyped ('TOption t) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TOption t)

WellTyped t => WellTyped ('TList t) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TList t)

(Comparable t, WellTyped t) => WellTyped ('TSet t) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TSet t)

WellTyped t => WellTyped ('TContract t) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TContract t)

(WellTyped t1, WellTyped t2) => WellTyped ('TPair t1 t2) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TPair t1 t2)

(WellTyped t1, WellTyped t2) => WellTyped ('TOr t1 t2) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TOr t1 t2)

(WellTyped t1, WellTyped t2) => WellTyped ('TLambda t1 t2) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TLambda t1 t2)

(Comparable k, WellTyped k, WellTyped v) => WellTyped ('TMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TMap k v)

(Comparable k, WellTyped k, WellTyped v) => WellTyped ('TBigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type WellTypedSuperC ('TBigMap k v)

class IsoValuesStack (ts :: [Type]) where Source #

Isomorphism between Michelson stack and its Haskell reflection.

Instances

Instances details
IsoValuesStack ('[] :: [Type]) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

(IsoValue t, IsoValuesStack st) => IsoValuesStack (t ': st) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

toValStack :: Rec Identity (t ': st) -> Rec Value (ToTs (t ': st)) Source #

fromValStack :: Rec Value (ToTs (t ': st)) -> Rec Identity (t ': st) Source #

type family ToTs' (t :: [k]) :: [T] where ... Source #

Overloaded version of ToTs to work on Haskell and T stacks.

Equations

ToTs' (t :: [T]) = t 
ToTs' (a :: [Type]) = ToTs a 

type family ToTs (ts :: [Type]) :: [T] where ... Source #

Type function to convert a Haskell stack type to T-based one.

Equations

ToTs '[] = '[] 
ToTs (x ': xs) = ToT x ': ToTs xs 

type GenericIsoValue t = (IsoValue t, Generic t, ToT t ~ GValueType (Rep t)) Source #

Whether Michelson representation of the type is derived via Generics.

newtype BigMap k v Source #

Constructors

BigMap 

Fields

Instances

Instances details
(Eq k, Eq v) => Eq (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

(==) :: BigMap k v -> BigMap k v -> Bool #

(/=) :: BigMap k v -> BigMap k v -> Bool #

(Show k, Show v) => Show (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

showsPrec :: Int -> BigMap k v -> ShowS #

show :: BigMap k v -> String #

showList :: [BigMap k v] -> ShowS #

Ord k => Semigroup (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

(<>) :: BigMap k v -> BigMap k v -> BigMap k v #

sconcat :: NonEmpty (BigMap k v) -> BigMap k v #

stimes :: Integral b => b -> BigMap k v -> BigMap k v #

Ord k => Monoid (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

mempty :: BigMap k v #

mappend :: BigMap k v -> BigMap k v -> BigMap k v #

mconcat :: [BigMap k v] -> BigMap k v #

Default (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

def :: BigMap k v #

(WellTypedToT k, WellTypedToT v, Comparable (ToT k), Ord k, IsoValue k, IsoValue v) => IsoValue (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (BigMap k v) :: T Source #

Methods

toVal :: BigMap k v -> Value (ToT (BigMap k v)) Source #

fromVal :: Value (ToT (BigMap k v)) -> BigMap k v Source #

(PolyCTypeHasDocC '[k], PolyTypeHasDocC '[v], Ord k) => TypeHasDoc (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type ToT (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

type ToT (BigMap k v) = 'TBigMap (ToT k) (ToT v)
type TypeDocFieldDescriptions (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

data ContractRef (arg :: Type) Source #

Since Contract name is used to designate contract code, lets call analogy of TContract type as follows.

Note that type argument always designates an argument of entrypoint. If a contract has explicit default entrypoint (and no root entrypoint), ContractRef referring to it can never have the entire parameter as its type argument.

Instances

Instances details
Eq (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

(==) :: ContractRef arg -> ContractRef arg -> Bool #

(/=) :: ContractRef arg -> ContractRef arg -> Bool #

Show (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

showsPrec :: Int -> ContractRef arg -> ShowS #

show :: ContractRef arg -> String #

showList :: [ContractRef arg] -> ShowS #

WellTypedToT arg => Buildable (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Methods

build :: ContractRef arg -> Builder #

WellTypedToT arg => IsoValue (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (ContractRef arg) :: T Source #

PolyTypeHasDocC '[cp] => TypeHasDoc (ContractRef cp) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type ToT (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

type ToT (ContractRef arg) = 'TContract (ToT arg)
type TypeDocFieldDescriptions (ContractRef cp) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type EntrypointCall param arg = EntrypointCallT (ToT param) (ToT arg) Source #

newtype AnyIsoValue Source #

Any Haskell value which can be converted to Michelson Value.

Constructors

AnyIsoValue (forall a. IsoValue a => a) 

data SomeIsoValue where Source #

Hides some Haskell value put in line with Michelson Value.

Constructors

SomeIsoValue :: KnownIsoT a => a -> SomeIsoValue 

type family ToT' (t :: k) :: T where ... Source #

Overloaded version of ToT to work on Haskell and T types.

Equations

ToT' (t :: T) = t 
ToT' (t :: Type) = ToT t 

class WellTypedToT a => IsoValue a where Source #

Isomorphism between Michelson values and plain Haskell types.

Default implementation of this typeclass converts ADTs to Michelson "pair"s and "or"s.

Minimal complete definition

Nothing

Associated Types

type ToT a :: T Source #

Type function that converts a regular Haskell type into a T type.

type ToT a = GValueType (Rep a) Source #

Methods

toVal :: a -> Value (ToT a) Source #

Converts a Haskell structure into Value representation.

default toVal :: (Generic a, GIsoValue (Rep a), ToT a ~ GValueType (Rep a)) => a -> Value (ToT a) Source #

fromVal :: Value (ToT a) -> a Source #

Converts a Value into Haskell type.

default fromVal :: (Generic a, GIsoValue (Rep a), ToT a ~ GValueType (Rep a)) => Value (ToT a) -> a Source #

Instances

Instances details
IsoValue Bool Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Bool :: T Source #

IsoValue Integer Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Integer :: T Source #

IsoValue Natural Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Natural :: T Source #

IsoValue () Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT () :: T Source #

Methods

toVal :: () -> Value (ToT ()) Source #

fromVal :: Value (ToT ()) -> () Source #

IsoValue ByteString Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT ByteString :: T Source #

(DoNotUseTextError :: Constraint) => IsoValue Text Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Text :: T Source #

IsoValue MText Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT MText :: T Source #

IsoValue KeyHash Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT KeyHash :: T Source #

IsoValue Signature Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Signature :: T Source #

IsoValue PublicKey Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT PublicKey :: T Source #

IsoValue ChainId Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT ChainId :: T Source #

IsoValue Timestamp Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Timestamp :: T Source #

IsoValue Mutez Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Mutez :: T Source #

IsoValue Address Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Address :: T Source #

IsoValue EpAddress Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT EpAddress :: T Source #

IsoValue Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Operation :: T Source #

IsoValue MyCompoundType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

Associated Types

type ToT MyCompoundType :: T Source #

IsoValue a => IsoValue [a] Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT [a] :: T Source #

Methods

toVal :: [a] -> Value (ToT [a]) Source #

fromVal :: Value (ToT [a]) -> [a] Source #

IsoValue a => IsoValue (Maybe a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (Maybe a) :: T Source #

Methods

toVal :: Maybe a -> Value (ToT (Maybe a)) Source #

fromVal :: Value (ToT (Maybe a)) -> Maybe a Source #

IsoValue a => IsoValue (Identity a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (Identity a) :: T Source #

(Comparable (ToT c), Ord c, IsoValue c) => IsoValue (Set c) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (Set c) :: T Source #

Methods

toVal :: Set c -> Value (ToT (Set c)) Source #

fromVal :: Value (ToT (Set c)) -> Set c Source #

WellTypedToT arg => IsoValue (ContractRef arg) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (ContractRef arg) :: T Source #

(IsoValue l, IsoValue r) => IsoValue (Either l r) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (Either l r) :: T Source #

Methods

toVal :: Either l r -> Value (ToT (Either l r)) Source #

fromVal :: Value (ToT (Either l r)) -> Either l r Source #

(IsoValue a, IsoValue b) => IsoValue (a, b) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b) :: T Source #

Methods

toVal :: (a, b) -> Value (ToT (a, b)) Source #

fromVal :: Value (ToT (a, b)) -> (a, b) Source #

(Comparable (ToT k), Ord k, IsoValue k, IsoValue v) => IsoValue (Map k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (Map k v) :: T Source #

Methods

toVal :: Map k v -> Value (ToT (Map k v)) Source #

fromVal :: Value (ToT (Map k v)) -> Map k v Source #

(WellTypedToT k, WellTypedToT v, Comparable (ToT k), Ord k, IsoValue k, IsoValue v) => IsoValue (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (BigMap k v) :: T Source #

Methods

toVal :: BigMap k v -> Value (ToT (BigMap k v)) Source #

fromVal :: Value (ToT (BigMap k v)) -> BigMap k v Source #

(IsoValue a, IsoValue b, IsoValue c) => IsoValue (a, b, c) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b, c) :: T Source #

Methods

toVal :: (a, b, c) -> Value (ToT (a, b, c)) Source #

fromVal :: Value (ToT (a, b, c)) -> (a, b, c) Source #

IsoValue a => IsoValue (NamedF Maybe a name) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (NamedF Maybe a name) :: T Source #

Methods

toVal :: NamedF Maybe a name -> Value (ToT (NamedF Maybe a name)) Source #

fromVal :: Value (ToT (NamedF Maybe a name)) -> NamedF Maybe a name Source #

IsoValue a => IsoValue (NamedF Identity a name) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (NamedF Identity a name) :: T Source #

Methods

toVal :: NamedF Identity a name -> Value (ToT (NamedF Identity a name)) Source #

fromVal :: Value (ToT (NamedF Identity a name)) -> NamedF Identity a name Source #

(IsoValue a, IsoValue b, IsoValue c, IsoValue d) => IsoValue (a, b, c, d) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b, c, d) :: T Source #

Methods

toVal :: (a, b, c, d) -> Value (ToT (a, b, c, d)) Source #

fromVal :: Value (ToT (a, b, c, d)) -> (a, b, c, d) Source #

(IsoValue a, IsoValue b, IsoValue c, IsoValue d, IsoValue e) => IsoValue (a, b, c, d, e) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b, c, d, e) :: T Source #

Methods

toVal :: (a, b, c, d, e) -> Value (ToT (a, b, c, d, e)) Source #

fromVal :: Value (ToT (a, b, c, d, e)) -> (a, b, c, d, e) Source #

(IsoValue a, IsoValue b, IsoValue c, IsoValue d, IsoValue e, IsoValue f) => IsoValue (a, b, c, d, e, f) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b, c, d, e, f) :: T Source #

Methods

toVal :: (a, b, c, d, e, f) -> Value (ToT (a, b, c, d, e, f)) Source #

fromVal :: Value (ToT (a, b, c, d, e, f)) -> (a, b, c, d, e, f) Source #

(IsoValue a, IsoValue b, IsoValue c, IsoValue d, IsoValue e, IsoValue f, IsoValue g) => IsoValue (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT (a, b, c, d, e, f, g) :: T Source #

Methods

toVal :: (a, b, c, d, e, f, g) -> Value (ToT (a, b, c, d, e, f, g)) Source #

fromVal :: Value (ToT (a, b, c, d, e, f, g)) -> (a, b, c, d, e, f, g) Source #

type KnownIsoT a = KnownT (ToT a) Source #

coerceContractRef :: ToT a ~ ToT b => ContractRef a -> ContractRef b Source #

Replace type argument of ContractAddr with isomorphic one.

totsAppendLemma :: forall a b. KnownList a => Dict (ToTs (a ++ b) ~ (ToTs a ++ ToTs b)) Source #

type InstrUnwrapC dt name = (GenericIsoValue dt, GInstrUnwrap (Rep dt) (LnrBranch (GetNamed name dt)) (CtorOnlyField name dt)) Source #

type family GCaseBranchInput ctor x :: CaseClauseParam Source #

Instances

Instances details
type GCaseBranchInput ctor (U1 :: Type -> Type) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (Rec0 a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (Rec0 a) = 'CaseClauseParam ctor ('OneField a)
type GCaseBranchInput ctor (S1 i x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (S1 i x) = GCaseBranchInput ctor x
type GCaseBranchInput ctor (x :*: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (x :*: y) = 'CaseClauseParam ctor 'NoFields

type family GCaseBranchInput ctor x :: CaseClauseParam Source #

Instances

Instances details
type GCaseBranchInput ctor (U1 :: Type -> Type) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (Rec0 a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (Rec0 a) = 'CaseClauseParam ctor ('OneField a)
type GCaseBranchInput ctor (S1 i x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (S1 i x) = GCaseBranchInput ctor x
type GCaseBranchInput ctor (x :*: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseBranchInput ctor (x :*: y) = 'CaseClauseParam ctor 'NoFields

type family GCaseClauses x :: [CaseClauseParam] Source #

Instances

Instances details
type GCaseClauses (x :+: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (D1 i x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (C1 ('MetaCons ctor _1 _2) x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (C1 ('MetaCons ctor _1 _2) x) = '[GCaseBranchInput ctor x]

type family GCaseClauses x :: [CaseClauseParam] Source #

Instances

Instances details
type GCaseClauses (x :+: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (D1 i x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (C1 ('MetaCons ctor _1 _2) x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Sum

type GCaseClauses (C1 ('MetaCons ctor _1 _2) x) = '[GCaseBranchInput ctor x]

type CaseClauses a = GCaseClauses (Rep a) Source #

List of CaseClauseParams required to pattern match on the given type.

data CaseClause (inp :: [T]) (out :: [T]) (param :: CaseClauseParam) where Source #

Type information about single case clause.

Constructors

CaseClause :: RemFail Instr (AppendCtorField x inp) out -> CaseClause inp out ('CaseClauseParam ctor x) 

data CaseClauseParam Source #

In what different case branches differ - related constructor name and input stack type which the branch starts with.

type InstrCaseC dt = (GenericIsoValue dt, GInstrCase (Rep dt)) Source #

type InstrWrapOneC dt name = (InstrWrapC dt name, GetCtorField dt name ~ 'OneField (CtorOnlyField name dt)) Source #

type InstrWrapC dt name = (GenericIsoValue dt, GInstrWrap (Rep dt) (LnrBranch (GetNamed name dt)) (LnrFieldType (GetNamed name dt))) Source #

type CtorOnlyField name dt = RequireOneField name (GetCtorField dt name) Source #

Expect referred constructor to have only one field (otherwise compile error is raised) and extract its type.

type CtorHasOnlyField ctor dt f = GetCtorField dt ctor ~ 'OneField f Source #

Expect referred constructor to have only one field (in form of constraint) and extract its type.

type GetCtorField dt ctor = LnrFieldType (GetNamed ctor dt) Source #

Get type of constructor fields (one or zero) referred by given datatype and name.

type AppendCtorFieldAxiom (cf :: CtorField) (st :: [Type]) = ToTs (AppendCtorField cf st) ~ AppendCtorField cf (ToTs st) Source #

To use AppendCtorField not only here for T-based stacks, but also later in Lorentz with Type-based stacks we need the following property.

type family AppendCtorField (cf :: CtorField) (l :: [k]) :: [k] where ... Source #

Push field to stack, if any.

Equations

AppendCtorField ('OneField t) (l :: [T]) = ToT t ': l 
AppendCtorField ('OneField t) (l :: [Type]) = t ': l 
AppendCtorField 'NoFields (l :: [T]) = l 
AppendCtorField 'NoFields (l :: [Type]) = l 

type family ExtractCtorField (cf :: CtorField) where ... Source #

Get something as field of the given constructor.

data CtorField Source #

We support only two scenarious - constructor with one field and without fields. Nonetheless, it's not that sad since for sum types we can't even assign names to fields if there are many (the style guide prohibits partial records).

Constructors

OneField Type 
NoFields 

instrWrap :: forall dt name st. InstrWrapC dt name => Label name -> Instr (AppendCtorField (GetCtorField dt name) st) (ToT dt ': st) Source #

Wrap given element into a constructor with the given name.

Mentioned constructor must have only one field.

Since labels interpretable by OverloadedLabels extension cannot start with capital latter, prepend constructor name with letter "c" (see examples below).

instrWrapOne :: forall dt name st. InstrWrapOneC dt name => Label name -> Instr (ToT (CtorOnlyField name dt) ': st) (ToT dt ': st) Source #

Like instrWrap but only works for contructors with a single field. Results in a type error if a constructor with no field is used instead.

hsWrap :: forall dt name. InstrWrapC dt name => Label name -> ExtractCtorField (GetCtorField dt name) -> dt Source #

Wrap a haskell value into a constructor with the given name.

This is symmetric to instrWrap.

instrCase :: forall dt out inp. InstrCaseC dt => Rec (CaseClause inp out) (CaseClauses dt) -> RemFail Instr (ToT dt ': inp) out Source #

Pattern-match on the given datatype.

(//->) :: Label ("c" `AppendSymbol` ctor) -> RemFail Instr (AppendCtorField x inp) out -> CaseClause inp out ('CaseClauseParam ctor x) infixr 8 Source #

Lift an instruction to case clause.

You should write out constructor name corresponding to the clause explicitly. Prefix constructor name with "c" letter, otherwise your label will not be recognized by Haskell parser. Passing constructor name can be circumvented but doing so is not recomended as mentioning contructor name improves readability and allows avoiding some mistakes.

instrUnwrapUnsafe :: forall dt name st. InstrUnwrapC dt name => Label name -> Instr (ToT dt ': st) (ToT (CtorOnlyField name dt) ': st) Source #

Unwrap a constructor with the given name.

Rules which apply to instrWrap function work here as well. Although, unlike instrWrap, this function does not work for nullary constructors.

hsUnwrap :: forall dt name. InstrUnwrapC dt name => Label name -> dt -> Maybe (CtorOnlyField name dt) Source #

Try to unwrap a constructor with the given name.

type InstrDeconstructC dt = (GenericIsoValue dt, GInstrDeconstruct (Rep dt)) Source #

Constraint for instrConstruct.

type InstrConstructC dt = (GenericIsoValue dt, GInstrConstruct (Rep dt)) Source #

Constraint for instrConstruct and gInstrConstructStack.

type ConstructorFieldNames dt = GFieldNames (Rep dt) Source #

Names of all fields in a datatype.

type ConstructorFieldTypes dt = GFieldTypes (Rep dt) Source #

Types of all fields in a datatype.

class ToTs xs ~ ToTs ys => CastFieldConstructors xs ys where Source #

Ability to pass list of fields with the same ToTs. It may be useful if you don't want to work with NamedF in ConstructorFieldTypes.

Instances

Instances details
CastFieldConstructors ('[] :: [Type]) ('[] :: [Type]) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Product

Methods

castFieldConstructorsImpl :: forall k (st :: [k]). Rec (FieldConstructor st) '[] -> Rec (FieldConstructor st) '[] Source #

(CastFieldConstructors xs ys, ToTs xs ~ ToTs ys, ToT x ~ ToT y) => CastFieldConstructors (x ': xs) (y ': ys) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Instr.Product

Methods

castFieldConstructorsImpl :: forall k (st :: [k]). Rec (FieldConstructor st) (x ': xs) -> Rec (FieldConstructor st) (y ': ys) Source #

newtype FieldConstructor (st :: [k]) (field :: Type) Source #

Way to construct one of the fields in a complex datatype.

Constructors

FieldConstructor (Instr (ToTs' st) (ToT field ': ToTs' st)) 

type InstrSetFieldC dt name = (GenericIsoValue dt, GInstrSetField name (Rep dt) (LnrBranch (GetNamed name dt)) (LnrFieldType (GetNamed name dt))) Source #

Constraint for instrSetField.

type InstrGetFieldC dt name = (GenericIsoValue dt, GInstrGet name (Rep dt) (LnrBranch (GetNamed name dt)) (LnrFieldType (GetNamed name dt))) Source #

Constraint for instrGetField.

type GetFieldType dt name = LnrFieldType (GetNamed name dt) Source #

Get type of field by datatype it is contained in and field name.

instrGetField :: forall dt name st. InstrGetFieldC dt name => Label name -> Instr (ToT dt ': st) (ToT (GetFieldType dt name) ': st) Source #

Make an instruction which accesses given field of the given datatype.

instrSetField :: forall dt name st. InstrSetFieldC dt name => Label name -> Instr (ToT (GetFieldType dt name) ': (ToT dt ': st)) (ToT dt ': st) Source #

For given complex type dt and its field fieldTy update the field value.

instrConstruct :: forall dt st. InstrConstructC dt => Rec (FieldConstructor st) (ConstructorFieldTypes dt) -> Instr st (ToT dt ': st) Source #

For given complex type dt and its field fieldTy update the field value.

instrConstructStack :: forall dt stack st. (InstrConstructC dt, stack ~ ToTs (ConstructorFieldTypes dt), KnownList stack) => Instr (stack ++ st) (ToT dt ': st) Source #

instrDeconstruct :: forall dt stack st. (InstrDeconstructC dt, stack ~ ToTs (ConstructorFieldTypes dt), KnownList stack) => Instr (ToT dt ': st) (stack ++ st) Source #

For given complex type dt deconstruct it to its field types.

type LooseSumC dt = (Generic dt, GLooseSum (Rep dt)) Source #

Constraint for hsDecompose and hsCompose.

data ComposeResult a Source #

Possible outcomes of an attempt to construct a Haskell ADT value from constructor name and relevant data.

Constructors

ComposeOk a

Composed fine.

ComposeCtorNotFound

No constructor with such name.

ComposeFieldTypeMismatch TypeRep TypeRep

Found required constructor, but type of data does not correspond to provided one.

toTaggedVal :: LooseSumC dt => dt -> (Text, SomeValue) Source #

Decompose Haskell type into constructor name and data it carries, converting the latter into Michelson Value.

data FieldRep a Source #

Representation of a field with an optional description.

Constructors

FieldRep 

data ConstructorRep a Source #

Representation of a constructor with an optional description.

Constructors

ConstructorRep 

type ADTRep a = NonEmpty (ConstructorRep a) Source #

Stands for representation of some Haskell ADT corresponding to Michelson value. Type parameter a is what you put in place of each field of the datatype, e.g. information about field type.

This representation also includes descriptions of constructors and fields.

type PolyTypeHasDocC ts = Each '[TypeHasDoc] ts Source #

Constraint, required when deriving TypeHasDoc for polymorphic type with the least possible number of methods defined manually.

class GProductHasDoc (x :: Type -> Type) Source #

Product type traversal for TypeHasDoc.

Minimal complete definition

gProductDocHaskellRep

Instances

Instances details
GProductHasDoc (U1 :: Type -> Type) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

(GProductHasDoc x, GProductHasDoc y) => GProductHasDoc (x :*: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc a => GProductHasDoc (S1 ('MetaSel ('Nothing :: Maybe Symbol) _1 _2 _3) (Rec0 a)) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

(TypeHasDoc a, KnownSymbol field) => GProductHasDoc (S1 ('MetaSel ('Just field) _1 _2 _3) (Rec0 a)) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

class GTypeHasDoc (x :: Type -> Type) Source #

Generic traversal for automatic deriving of some methods in TypeHasDoc.

Minimal complete definition

gTypeDocHaskellRep

Instances

Instances details
(TypeError ('Text "Cannot derive documentation for void-like type") :: Constraint) => GTypeHasDoc (V1 :: Type -> Type) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

(GTypeHasDoc x, GTypeHasDoc y) => GTypeHasDoc (x :+: y) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

GTypeHasDoc x => GTypeHasDoc (D1 ('MetaData _a _b _c 'True) x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

GTypeHasDoc x => GTypeHasDoc (D1 ('MetaData _a _b _c 'False) x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

(GProductHasDoc x, KnownSymbol ctor) => GTypeHasDoc (C1 ('MetaCons ctor _1 _2) x) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

class IsHomomorphic a Source #

Require this type to be homomorphic.

Instances

Instances details
IsHomomorphic (a :: k) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

(TypeError ('Text "Type is not homomorphic: " :<>: 'ShowType (a b)) :: Constraint) => IsHomomorphic (a b :: k2) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

class HaveCommonTypeCtor a b Source #

Require two types to be built from the same type constructor.

E.g. HaveCommonTypeCtor (Maybe Integer) (Maybe Natural) is defined, while HaveCmmonTypeCtor (Maybe Integer) [Integer] is not.

Instances

Instances details
HaveCommonTypeCtor (a :: k) (a :: k) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

HaveCommonTypeCtor ac bc => HaveCommonTypeCtor (ac a :: k2) (bc b :: k4) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

newtype DStorageType Source #

Doc element with description of contract storage type.

Constructors

DStorageType DType 

Instances

Instances details
Eq DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Ord DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Generic DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type Rep DStorageType :: Type -> Type #

DocItem DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type Rep DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type Rep DStorageType = D1 ('MetaData "DStorageType" "Michelson.Typed.Haskell.Doc" "morley-1.12.0-inplace" 'True) (C1 ('MetaCons "DStorageType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DType)))
type DocItemPlacement DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type DocItemReferenced DStorageType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

data DType where Source #

Doc element with description of a type.

Constructors

DType :: TypeHasDoc a => Proxy a -> DType 

Instances

Instances details
Eq DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Methods

(==) :: DType -> DType -> Bool #

(/=) :: DType -> DType -> Bool #

Ord DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Methods

compare :: DType -> DType -> Ordering #

(<) :: DType -> DType -> Bool #

(<=) :: DType -> DType -> Bool #

(>) :: DType -> DType -> Bool #

(>=) :: DType -> DType -> Bool #

max :: DType -> DType -> DType #

min :: DType -> DType -> DType #

Show DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Methods

showsPrec :: Int -> DType -> ShowS #

show :: DType -> String #

showList :: [DType] -> ShowS #

DocItem DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type DocItemPlacement DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

type DocItemReferenced DType Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

data SomeTypeWithDoc where Source #

Data hides some type implementing TypeHasDoc.

Constructors

SomeTypeWithDoc :: TypeHasDoc td => Proxy td -> SomeTypeWithDoc 

type TypeDocMichelsonRep a = Proxy a -> (Maybe DocTypeRepLHS, T) Source #

Signature of typeDocMichelsonRep function.

As in TypeDocHaskellRep, set the first element of the pair to Nothing for primitive types, otherwise it stands as some instantiation of a type, and its Michelson representation is given in the second element of the pair.

Examples of rendered representation:

  • pair int nat - for homomorphic type.
  • MyError Integer = pair string int - concrete sample for polymorhpic type.

type TypeDocHaskellRep a = Proxy a -> FieldDescriptionsV -> Maybe (Maybe DocTypeRepLHS, ADTRep SomeTypeWithDoc) Source #

Signature of typeDocHaskellRep function.

A value of FieldDescriptionsV is provided by the library to make sure that instances won't replace it with an unchecked value.

When value is Just, it contains types which this type is built from.

First element of provided pair may contain name a concrete type which has the same type constructor as a (or just a for homomorphic types), and the second element of the pair - its unfolding in Haskell.

For example, for some newtype MyNewtype = MyNewtype (Integer, Natural) we would not specify the first element in the pair because MyNewtype is already a concrete type, and second element would contain (Integer, Natural). For polymorhpic types like newtype MyPolyNewtype a = MyPolyNewtype (Text, a), we want to describe its representation on some example of a, because working with type variables is too non-trivial; so the first element of the pair may be e.g. "MyPolyNewType Integer", and the second one shows that it unfolds to (Text, Integer).

When rendered, values of this type look like:

  • (Integer, Natural) - for homomorphic type.
  • MyError Integer = (Text, Integer) - concrete sample for polymorhpic type.

class (Typeable a, SingI (TypeDocFieldDescriptions a), FieldDescriptionsValid (TypeDocFieldDescriptions a) a) => TypeHasDoc a where Source #

Description for a Haskell type appearing in documentation.

Minimal complete definition

typeDocMdDescription

Associated Types

type TypeDocFieldDescriptions a :: FieldDescriptions Source #

Description of constructors and fields of a.

See FieldDescriptions documentation for an example of usage.

Descriptions will be checked at compile time to make sure that only existing constructors and fields are referenced.

For that check to work instance Generic a is required whenever TypeDocFieldDescriptions is not empty.

For implementation of the check see FieldDescriptionsValid type family.

Methods

typeDocName :: Proxy a -> Text Source #

Name of type as it appears in definitions section.

Each type must have its own unique name because it will be used in identifier for references.

Default definition derives name from Generics. If it does not fit, consider defining this function manually. (We tried using Data for this, but it produces names including module names which is not do we want).

typeDocMdDescription :: Markdown Source #

Explanation of a type. Markdown formatting is allowed.

typeDocMdReference :: Proxy a -> WithinParens -> Markdown Source #

How reference to this type is rendered, in Markdown.

Examples:

  • [Integer](#type-integer),
  • [Maybe](#type-Maybe) [()](#type-unit).

Consider using one of the following functions as default implementation; which one to use depends on number of type arguments in your type:

If none of them fits your purposes precisely, consider using customTypeDocMdReference.

typeDocDependencies :: Proxy a -> [SomeDocDefinitionItem] Source #

All types which this type directly contains.

Used in automatic types discovery.

typeDocHaskellRep :: TypeDocHaskellRep a Source #

For complex types - their immediate Haskell representation.

For primitive types set this to Nothing.

For homomorphic types use homomorphicTypeDocHaskellRep implementation.

For polymorhpic types consider using concreteTypeDocHaskellRep as implementation.

Modifier haskellRepNoFields can be used to hide names of fields, beneficial for newtypes.

Another modifier called haskellRepStripFieldPrefix can be used for datatypes to leave only meaningful part of name in every field.

typeDocMichelsonRep :: TypeDocMichelsonRep a Source #

Final michelson representation of a type.

For homomorphic types use homomorphicTypeDocMichelsonRep implementation.

For polymorhpic types consider using concreteTypeDocMichelsonRep as implementation.

Instances

Instances details
TypeHasDoc Bool Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Integer Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Natural Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc () Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc ByteString Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc MText Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc KeyHash Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Signature Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc PublicKey Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc ChainId Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Timestamp Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Mutez Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Address Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc EpAddress Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

TypeHasDoc Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[a] => TypeHasDoc [a] Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[a] => TypeHasDoc (Maybe a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyCTypeHasDocC '[a] => TypeHasDoc (Set a) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[cp] => TypeHasDoc (ContractRef cp) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[l, r] => TypeHasDoc (Either l r) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[a, b] => TypeHasDoc (a, b) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b) :: FieldDescriptions Source #

(PolyCTypeHasDocC '[k], PolyTypeHasDocC '[v], Ord k) => TypeHasDoc (Map k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (Map k v) :: FieldDescriptions Source #

(PolyCTypeHasDocC '[k], PolyTypeHasDocC '[v], Ord k) => TypeHasDoc (BigMap k v) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

PolyTypeHasDocC '[a, b, c] => TypeHasDoc (a, b, c) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b, c) :: FieldDescriptions Source #

(TypeHasDoc (ApplyNamedFunctor f a), KnownSymbol n, SingI (ToT (ApplyNamedFunctor f Integer)), Typeable f, Typeable a) => TypeHasDoc (NamedF f a n) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (NamedF f a n) :: FieldDescriptions Source #

PolyTypeHasDocC '[a, b, c, d] => TypeHasDoc (a, b, c, d) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b, c, d) :: FieldDescriptions Source #

PolyTypeHasDocC '[a, b, c, d, e] => TypeHasDoc (a, b, c, d, e) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b, c, d, e) :: FieldDescriptions Source #

PolyTypeHasDocC '[a, b, c, d, e, f] => TypeHasDoc (a, b, c, d, e, f) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b, c, d, e, f) :: FieldDescriptions Source #

PolyTypeHasDocC '[a, b, c, d, e, f, g] => TypeHasDoc (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Associated Types

type TypeDocFieldDescriptions (a, b, c, d, e, f, g) :: FieldDescriptions Source #

Methods

typeDocName :: Proxy (a, b, c, d, e, f, g) -> Text Source #

typeDocMdDescription :: Markdown Source #

typeDocMdReference :: Proxy (a, b, c, d, e, f, g) -> WithinParens -> Markdown Source #

typeDocDependencies :: Proxy (a, b, c, d, e, f, g) -> [SomeDocDefinitionItem] Source #

typeDocHaskellRep :: TypeDocHaskellRep (a, b, c, d, e, f, g) Source #

typeDocMichelsonRep :: TypeDocMichelsonRep (a, b, c, d, e, f, g) Source #

newtype WithinParens Source #

Whether given text should be rendered grouped in parentheses (if they make sense).

Constructors

WithinParens Bool 

frNameL :: forall a. Lens' (FieldRep a) (Maybe Text) Source #

frTypeRepL :: forall a a. Lens (FieldRep a) (FieldRep a) a a Source #

buildADTRep :: forall a. (WithinParens -> a -> Markdown) -> ADTRep a -> Markdown Source #

Show given ADTRep in a neat way.

dTypeDep :: forall (t :: Type). TypeHasDoc t => SomeDocDefinitionItem Source #

Create a DType in form suitable for putting to typeDocDependencies.

dTypeDepP :: forall (t :: Type). TypeHasDoc t => Proxy t -> SomeDocDefinitionItem Source #

Proxy version of dTypeDep.

dStorage :: forall store. TypeHasDoc store => DStorageType Source #

Shortcut for DStorageType.

customTypeDocMdReference :: (Text, DType) -> [DType] -> WithinParens -> Markdown Source #

Render a reference to a type which consists of type constructor (you have to provide name of this type constructor and documentation for the whole type) and zero or more type arguments.

homomorphicTypeDocMdReference :: forall (t :: Type). (Typeable t, TypeHasDoc t, IsHomomorphic t) => Proxy t -> WithinParens -> Markdown Source #

Derive typeDocMdReference, for homomorphic types only.

poly1TypeDocMdReference :: forall t (r :: Type) (a :: Type). (r ~ t a, Typeable t, Each '[TypeHasDoc] [r, a], IsHomomorphic t) => Proxy r -> WithinParens -> Markdown Source #

Derive typeDocMdReference, for polymorphic type with one type argument, like Maybe Integer.

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 Source #

Derive typeDocMdReference, for polymorphic type with two type arguments, like Lambda Integer Natural.

genericTypeDocDependencies :: forall a. (Generic a, GTypeHasDoc (Rep a)) => Proxy a -> [SomeDocDefinitionItem] Source #

Implement typeDocDependencies via getting all immediate fields of a datatype.

Note: this will not include phantom types, I'm not sure yet how this scenario should be handled (@martoon).

homomorphicTypeDocHaskellRep :: forall a. (Generic a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep a Source #

Implement typeDocHaskellRep for a homomorphic type.

Note that it does not require your type to be of IsHomomorphic instance, which can be useful for some polymorhpic types which, for documentation purposes, we want to consider homomorphic.

Example: Operation is in fact polymorhpic, but we don't want this fact to be reflected in the documentation.

concreteTypeDocHaskellRep :: forall a b. (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a), HaveCommonTypeCtor b a) => TypeDocHaskellRep b Source #

Implement typeDocHaskellRep on example of given concrete type.

This is a best effort attempt to implement typeDocHaskellRep for polymorhpic types, as soon as there is no simple way to preserve type variables when automatically deriving Haskell representation of a type.

concreteTypeDocHaskellRepUnsafe :: forall a b. (Typeable a, GenericIsoValue a, GTypeHasDoc (Rep a)) => TypeDocHaskellRep b Source #

Version of concreteTypeDocHaskellRep which does not ensure whether the type for which representation is built is any similar to the original type which you implement a TypeHasDoc instance for.

haskellRepNoFields :: TypeDocHaskellRep a -> TypeDocHaskellRep a Source #

Erase fields from Haskell datatype representation.

Use this when rendering fields names is undesired.

haskellAddNewtypeField :: Text -> TypeDocHaskellRep a -> TypeDocHaskellRep a Source #

Add field name for newtype.

Since newtype field is automatically erased. Use this function to add the desired field name.

haskellRepStripFieldPrefix :: HasCallStack => TypeDocHaskellRep a -> TypeDocHaskellRep a Source #

Cut fields prefixes which we use according to the style guide.

E.g. cmMyField field will be transformed to myField.

homomorphicTypeDocMichelsonRep :: forall a. SingI (ToT a) => TypeDocMichelsonRep a Source #

Implement typeDocMichelsonRep for homomorphic type.

concreteTypeDocMichelsonRep :: forall a b. (Typeable a, SingI (ToT a), HaveCommonTypeCtor b a) => TypeDocMichelsonRep b Source #

Implement typeDocMichelsonRep on example of given concrete type.

This function exists for the same reason as concreteTypeDocHaskellRep.

concreteTypeDocMichelsonRepUnsafe :: forall a b. (Typeable a, SingI (ToT a)) => TypeDocMichelsonRep b Source #

Version of concreteTypeDocHaskellRepUnsafe which does not ensure whether the type for which representation is built is any similar to the original type which you implement a TypeHasDoc instance for.