morley-1.20.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Typed.Scope.Internal.WellTyped

Synopsis

Documentation

data BadTypeForScope Source #

Instances

Instances details
Generic BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

Associated Types

type Rep BadTypeForScope :: Type -> Type #

Show BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

NFData BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

Methods

rnf :: BadTypeForScope -> () #

Eq BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

Buildable BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

Methods

build :: BadTypeForScope -> Doc

buildList :: [BadTypeForScope] -> Doc

type Rep BadTypeForScope Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

type Rep BadTypeForScope = D1 ('MetaData "BadTypeForScope" "Morley.Michelson.Typed.Scope.Internal.WellTyped" "morley-1.20.0-inplace" 'False) ((C1 ('MetaCons "BtNotComparable" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BtIsOperation" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BtHasBigMap" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BtHasNestedBigMap" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BtHasContract" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BtHasTicket" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BtHasSaplingState" 'PrefixI 'False) (U1 :: Type -> Type))))

class (SingI t, RecSuperC WellTyped t, WellTypedConstraints t) => WellTyped 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.

data NotWellTyped Source #

Error type for when a value is not well-typed.

Constructors

NotWellTyped 

Instances

Instances details
Buildable NotWellTyped Source # 
Instance details

Defined in Morley.Michelson.Typed.Scope.Internal.WellTyped

Methods

build :: NotWellTyped -> Doc

buildList :: [NotWellTyped] -> Doc

type family WellTypedConstraints t where ... Source #

Additional (non-recursive) constraints on type arguments for specific types

getWTP :: forall t. SingI t => Either NotWellTyped (Dict (WellTyped t)) Source #

Given a type, provide evidence that it is well typed w.r.t to the Michelson rules regarding where comparable types are required.

>>> either pretty print $ getWTP @'TUnit
Dict
>>> either pretty print $ getWTP @('TSet 'TOperation)
Given type is not well typed because 'operation' is not comparable
>>> type Pairs a = 'TPair a a
>>> type Pairs2 = Pairs (Pairs 'TUnit)
>>> either pretty print $ getWTP @('TSet ('TPair Pairs2 'TOperation))
Given type is not well typed because
  pair (pair (pair unit unit) unit unit) operation
is not comparable

getWTP' :: Sing t -> Either NotWellTyped (Dict (WellTyped t)) Source #

Version of getWTP that accepts Sing at term-level.