morley-1.0.0: Developer tools for the Michelson Language

Safe HaskellNone
LanguageHaskell2010

Michelson.Typed.Extract

Description

Module, containing functions to convert Michelson.Untyped.Type to Michelson.Typed.T.T Michelson type representation (type stripped off all annotations) and to Michelson.Typed.Annotation.Notes value (which contains field and type annotations for a given Michelson type).

I.e. Michelson.Untyped.Type is split to value t :: T and value of type Notes t for which t is a type representation of value t.

Synopsis

Documentation

mkUType :: Sing x -> Notes x -> Type Source #

toUType :: T -> Type Source #

Converts from T to Type.

withUType :: Type -> (forall t. (Typeable t, SingI t) => (Sing t, Notes t) -> r) -> r Source #

Convert Type to the isomorphic set of information from typed world.

pattern AsUType :: () => (Typeable t, SingI t) => Sing t -> Notes t -> Type Source #

Transparently represent untyped Type as wrapper over (Sing t, Notes t) from typed world.

As expression this carries logic of mkUType, and as pattern it performs withUType but may make code a bit cleaner.

Note about constraints: pattern signatures usually require two constraints - one they require and another one which they provide. In our case we require nothing (thus first constraint is ()) and provide some knowledge about t.