module Michelson.Untyped.Type
( Type (..)
, T (..)
, ParameterType (..)
, toption
, tpair
, tor
, tyint
, tynat
, tyunit
, tybool
, typair
, tyor
, tyImplicitAccountParam
, isAtomicType
, isKey
, isSignature
, isComparable
, isMutez
, isKeyHash
, isBool
, isString
, isInteger
, isTimestamp
, isNat
, isInt
, isBytes
, renderType
, unwrapT
) where
import Data.Aeson.TH (deriveJSON)
import Data.Data (Data(..))
import Fmt (Buildable(build))
import Language.Haskell.TH.Lift (deriveLift)
import Prelude hiding ((<$>))
import Text.PrettyPrint.Leijen.Text (Doc, align, softbreak, (<$>), (<+>))
import Michelson.Printer.Util
(Prettier(..), RenderContext, RenderDoc(..), addParens, buildRenderDoc, doesntNeedParens,
needsParens, wrapInParens)
import Michelson.Untyped.Annotation
(AnnotationSet, FieldAnn, RootAnn, TypeAnn, emptyAnnSet, fullAnnSet, noAnn, singleAnnSet)
import Util.Aeson
data Type
= Type ~T TypeAnn
deriving stock (Type -> Type -> Bool
(Type -> Type -> Bool) -> (Type -> Type -> Bool) -> Eq Type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Type -> Type -> Bool
$c/= :: Type -> Type -> Bool
== :: Type -> Type -> Bool
$c== :: Type -> Type -> Bool
Eq, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
(Int -> Type -> ShowS)
-> (Type -> String) -> ([Type] -> ShowS) -> Show Type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> String
$cshow :: Type -> String
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show, Typeable Type
DataType
Constr
Typeable Type =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type)
-> (Type -> Constr)
-> (Type -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type))
-> ((forall b. Data b => b -> b) -> Type -> Type)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r)
-> (forall u. (forall d. Data d => d -> u) -> Type -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Type -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type)
-> Data Type
Type -> DataType
Type -> Constr
(forall b. Data b => b -> b) -> Type -> Type
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
forall u. (forall d. Data d => d -> u) -> Type -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
$cType :: Constr
$tType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Type -> m Type
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapMp :: (forall d. Data d => d -> m d) -> Type -> m Type
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapM :: (forall d. Data d => d -> m d) -> Type -> m Type
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Type -> m Type
gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Type -> u
gmapQ :: (forall d. Data d => d -> u) -> Type -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Type -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r
gmapT :: (forall b. Data b => b -> b) -> Type -> Type
$cgmapT :: (forall b. Data b => b -> b) -> Type -> Type
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Type)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Type)
dataTypeOf :: Type -> DataType
$cdataTypeOf :: Type -> DataType
toConstr :: Type -> Constr
$ctoConstr :: Type -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Type
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Type -> c Type
$cp1Data :: Typeable Type
Data, (forall x. Type -> Rep Type x)
-> (forall x. Rep Type x -> Type) -> Generic Type
forall x. Rep Type x -> Type
forall x. Type -> Rep Type x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Type x -> Type
$cfrom :: forall x. Type -> Rep Type x
Generic)
unwrapT :: Type -> T
unwrapT :: Type -> T
unwrapT (Type t :: T
t _) = T
t
instance NFData Type
instance RenderDoc (Prettier Type) where
renderDoc :: RenderContext -> Prettier Type -> Doc
renderDoc pn :: RenderContext
pn (Prettier w :: Type
w) = case Type
w of
(Type t :: T
t ta :: TypeAnn
ta) -> T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t Bool
False RenderContext
pn (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta)
instance RenderDoc Type where
renderDoc :: RenderContext -> Type -> Doc
renderDoc pn :: RenderContext
pn (Type t :: T
t ta :: TypeAnn
ta) = T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t Bool
True RenderContext
pn (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta)
instance RenderDoc T where
renderDoc :: RenderContext -> T -> Doc
renderDoc pn :: RenderContext
pn t :: T
t = T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t Bool
True RenderContext
pn AnnotationSet
emptyAnnSet
data ParameterType = ParameterType Type RootAnn
deriving stock (ParameterType -> ParameterType -> Bool
(ParameterType -> ParameterType -> Bool)
-> (ParameterType -> ParameterType -> Bool) -> Eq ParameterType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterType -> ParameterType -> Bool
$c/= :: ParameterType -> ParameterType -> Bool
== :: ParameterType -> ParameterType -> Bool
$c== :: ParameterType -> ParameterType -> Bool
Eq, Int -> ParameterType -> ShowS
[ParameterType] -> ShowS
ParameterType -> String
(Int -> ParameterType -> ShowS)
-> (ParameterType -> String)
-> ([ParameterType] -> ShowS)
-> Show ParameterType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterType] -> ShowS
$cshowList :: [ParameterType] -> ShowS
show :: ParameterType -> String
$cshow :: ParameterType -> String
showsPrec :: Int -> ParameterType -> ShowS
$cshowsPrec :: Int -> ParameterType -> ShowS
Show, Typeable ParameterType
DataType
Constr
Typeable ParameterType =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParameterType -> c ParameterType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParameterType)
-> (ParameterType -> Constr)
-> (ParameterType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParameterType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ParameterType))
-> ((forall b. Data b => b -> b) -> ParameterType -> ParameterType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r)
-> (forall u. (forall d. Data d => d -> u) -> ParameterType -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ParameterType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType)
-> Data ParameterType
ParameterType -> DataType
ParameterType -> Constr
(forall b. Data b => b -> b) -> ParameterType -> ParameterType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParameterType -> c ParameterType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParameterType
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ParameterType -> u
forall u. (forall d. Data d => d -> u) -> ParameterType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParameterType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParameterType -> c ParameterType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParameterType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ParameterType)
$cParameterType :: Constr
$tParameterType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
gmapMp :: (forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
gmapM :: (forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ParameterType -> m ParameterType
gmapQi :: Int -> (forall d. Data d => d -> u) -> ParameterType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ParameterType -> u
gmapQ :: (forall d. Data d => d -> u) -> ParameterType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ParameterType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ParameterType -> r
gmapT :: (forall b. Data b => b -> b) -> ParameterType -> ParameterType
$cgmapT :: (forall b. Data b => b -> b) -> ParameterType -> ParameterType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ParameterType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ParameterType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ParameterType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ParameterType)
dataTypeOf :: ParameterType -> DataType
$cdataTypeOf :: ParameterType -> DataType
toConstr :: ParameterType -> Constr
$ctoConstr :: ParameterType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParameterType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ParameterType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParameterType -> c ParameterType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ParameterType -> c ParameterType
$cp1Data :: Typeable ParameterType
Data, (forall x. ParameterType -> Rep ParameterType x)
-> (forall x. Rep ParameterType x -> ParameterType)
-> Generic ParameterType
forall x. Rep ParameterType x -> ParameterType
forall x. ParameterType -> Rep ParameterType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterType x -> ParameterType
$cfrom :: forall x. ParameterType -> Rep ParameterType x
Generic)
instance NFData ParameterType
instance RenderDoc (Prettier ParameterType) where
renderDoc :: RenderContext -> Prettier ParameterType -> Doc
renderDoc pn :: RenderContext
pn (Prettier w :: ParameterType
w) = case ParameterType
w of
ParameterType (Type t :: T
t ta :: TypeAnn
ta) ra :: RootAnn
ra ->
T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t Bool
False RenderContext
pn ([TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta] [RootAnn
ra] [])
instance RenderDoc ParameterType where
renderDoc :: RenderContext -> ParameterType -> Doc
renderDoc pn :: RenderContext
pn (ParameterType (Type t :: T
t ta :: TypeAnn
ta) ra :: RootAnn
ra) =
T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t Bool
True RenderContext
pn ([TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta] [RootAnn
ra] [])
renderType
:: T
-> Bool
-> RenderContext
-> AnnotationSet
-> Doc
renderType :: T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType t :: T
t forceSingleLine :: Bool
forceSingleLine pn :: RenderContext
pn annSet :: AnnotationSet
annSet =
let annDoc :: Doc
annDoc = RenderContext -> AnnotationSet -> Doc
forall a. RenderDoc a => RenderContext -> a -> Doc
renderDoc RenderContext
doesntNeedParens AnnotationSet
annSet
recRenderer :: T -> AnnotationSet -> Doc
recRenderer t' :: T
t' annSet' :: AnnotationSet
annSet' = T -> Bool -> RenderContext -> AnnotationSet -> Doc
renderType T
t' Bool
forceSingleLine RenderContext
needsParens AnnotationSet
annSet'
renderBranches :: Doc -> Doc -> Doc
renderBranches d1 :: Doc
d1 d2 :: Doc
d2 =
if Bool
forceSingleLine
then (Doc
d1 Doc -> Doc -> Doc
<+> Doc
d2)
else Doc -> Doc
align (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ Doc
softbreak Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> (Doc
d1 Doc -> Doc -> Doc
<$> Doc
d2)
in
case T
t of
TInt -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "int" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TNat -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "nat" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TString -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "string" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TMutez -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "mutez" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TBool -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "bool" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TKeyHash -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "key_hash" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TTimestamp -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "timestamp" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TBytes -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "bytes" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TAddress -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "address" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TKey -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "key" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TUnit -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "unit" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TSignature -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "signature" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TChainId -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "chain_id" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TOperation -> RenderContext -> NonEmpty Doc -> Doc
wrapInParens RenderContext
pn (NonEmpty Doc -> Doc) -> NonEmpty Doc -> Doc
forall a b. (a -> b) -> a -> b
$ "operation" Doc -> [Doc] -> NonEmpty Doc
forall a. a -> [a] -> NonEmpty a
:| [Doc
annDoc]
TOption (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"option" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+> T -> AnnotationSet -> Doc
recRenderer T
t1 (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
TList (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"list" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+> T -> AnnotationSet -> Doc
recRenderer T
t1 (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
TSet (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"set" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+> T -> AnnotationSet -> Doc
recRenderer T
t1 (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
TContract (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"contract" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+> T -> AnnotationSet -> Doc
recRenderer T
t1 (TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
TPair fa1 :: RootAnn
fa1 fa2 :: RootAnn
fa2 (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) (Type t2 :: T
t2 ta2 :: TypeAnn
ta2) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"pair" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+>
Doc -> Doc -> Doc
renderBranches
(T -> AnnotationSet -> Doc
recRenderer T
t1 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ [TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta1] [RootAnn
fa1] [])
(T -> AnnotationSet -> Doc
recRenderer T
t2 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ [TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta2] [RootAnn
fa2] [])
TOr fa1 :: RootAnn
fa1 fa2 :: RootAnn
fa2 (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) (Type t2 :: T
t2 ta2 :: TypeAnn
ta2) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"or" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+>
Doc -> Doc -> Doc
renderBranches
(T -> AnnotationSet -> Doc
recRenderer T
t1 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ [TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta1] [RootAnn
fa1] [])
(T -> AnnotationSet -> Doc
recRenderer T
t2 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ [TypeAnn] -> [RootAnn] -> [VarAnn] -> AnnotationSet
fullAnnSet [TypeAnn
ta2] [RootAnn
fa2] [])
TLambda (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) (Type t2 :: T
t2 ta2 :: TypeAnn
ta2) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"lambda" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+>
Doc -> Doc -> Doc
renderBranches
(T -> AnnotationSet -> Doc
recRenderer T
t1 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
(T -> AnnotationSet -> Doc
recRenderer T
t2 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta2)
TMap (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) (Type t2 :: T
t2 ta2 :: TypeAnn
ta2) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"map" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+>
Doc -> Doc -> Doc
renderBranches
(T -> AnnotationSet -> Doc
recRenderer T
t1 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
(T -> AnnotationSet -> Doc
recRenderer T
t2 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta2)
TBigMap (Type t1 :: T
t1 ta1 :: TypeAnn
ta1) (Type t2 :: T
t2 ta2 :: TypeAnn
ta2) ->
RenderContext -> Doc -> Doc
addParens RenderContext
pn (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$
"big_map" Doc -> Doc -> Doc
<+> Doc
annDoc Doc -> Doc -> Doc
<+>
Doc -> Doc -> Doc
renderBranches
(T -> AnnotationSet -> Doc
recRenderer T
t1 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta1)
(T -> AnnotationSet -> Doc
recRenderer T
t2 (AnnotationSet -> Doc) -> AnnotationSet -> Doc
forall a b. (a -> b) -> a -> b
$ TypeAnn -> AnnotationSet
forall tag. KnownAnnTag tag => Annotation tag -> AnnotationSet
singleAnnSet TypeAnn
ta2)
instance Buildable Type where
build :: Type -> Builder
build = Type -> Builder
forall a. RenderDoc a => a -> Builder
buildRenderDoc
instance Buildable ParameterType where
build :: ParameterType -> Builder
build = ParameterType -> Builder
forall a. RenderDoc a => a -> Builder
buildRenderDoc
data T =
TKey
| TUnit
| TSignature
| TChainId
| TOption Type
| TList Type
| TSet Type
| TOperation
| TContract Type
| TPair FieldAnn FieldAnn Type Type
| TOr FieldAnn FieldAnn Type Type
| TLambda Type Type
| TMap Type Type
| TBigMap Type Type
| TInt
| TNat
| TString
| TBytes
| TMutez
| TBool
| TKeyHash
| TTimestamp
| TAddress
deriving stock (T -> T -> Bool
(T -> T -> Bool) -> (T -> T -> Bool) -> Eq T
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: T -> T -> Bool
$c/= :: T -> T -> Bool
== :: T -> T -> Bool
$c== :: T -> T -> Bool
Eq, Int -> T -> ShowS
[T] -> ShowS
T -> String
(Int -> T -> ShowS) -> (T -> String) -> ([T] -> ShowS) -> Show T
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [T] -> ShowS
$cshowList :: [T] -> ShowS
show :: T -> String
$cshow :: T -> String
showsPrec :: Int -> T -> ShowS
$cshowsPrec :: Int -> T -> ShowS
Show, Typeable T
DataType
Constr
Typeable T =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> T -> c T)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c T)
-> (T -> Constr)
-> (T -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c T))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c T))
-> ((forall b. Data b => b -> b) -> T -> T)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> T -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> T -> r)
-> (forall u. (forall d. Data d => d -> u) -> T -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> T -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> T -> m T)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> T -> m T)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> T -> m T)
-> Data T
T -> DataType
T -> Constr
(forall b. Data b => b -> b) -> T -> T
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> T -> c T
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c T
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> T -> u
forall u. (forall d. Data d => d -> u) -> T -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> T -> m T
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> T -> m T
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c T
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> T -> c T
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c T)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c T)
$cTAddress :: Constr
$cTTimestamp :: Constr
$cTKeyHash :: Constr
$cTBool :: Constr
$cTMutez :: Constr
$cTBytes :: Constr
$cTString :: Constr
$cTNat :: Constr
$cTInt :: Constr
$cTBigMap :: Constr
$cTMap :: Constr
$cTLambda :: Constr
$cTOr :: Constr
$cTPair :: Constr
$cTContract :: Constr
$cTOperation :: Constr
$cTSet :: Constr
$cTList :: Constr
$cTOption :: Constr
$cTChainId :: Constr
$cTSignature :: Constr
$cTUnit :: Constr
$cTKey :: Constr
$tT :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> T -> m T
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> T -> m T
gmapMp :: (forall d. Data d => d -> m d) -> T -> m T
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> T -> m T
gmapM :: (forall d. Data d => d -> m d) -> T -> m T
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> T -> m T
gmapQi :: Int -> (forall d. Data d => d -> u) -> T -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> T -> u
gmapQ :: (forall d. Data d => d -> u) -> T -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> T -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> T -> r
gmapT :: (forall b. Data b => b -> b) -> T -> T
$cgmapT :: (forall b. Data b => b -> b) -> T -> T
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c T)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c T)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c T)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c T)
dataTypeOf :: T -> DataType
$cdataTypeOf :: T -> DataType
toConstr :: T -> Constr
$ctoConstr :: T -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c T
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c T
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> T -> c T
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> T -> c T
$cp1Data :: Typeable T
Data, (forall x. T -> Rep T x) -> (forall x. Rep T x -> T) -> Generic T
forall x. Rep T x -> T
forall x. T -> Rep T x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep T x -> T
$cfrom :: forall x. T -> Rep T x
Generic)
instance Buildable T where
build :: T -> Builder
build = T -> Builder
forall a. RenderDoc a => a -> Builder
buildRenderDoc
instance NFData T
toption :: Type -> T
toption :: Type -> T
toption t :: Type
t = Type -> T
TOption Type
t
tpair :: Type -> Type -> T
tpair :: Type -> Type -> T
tpair l :: Type
l r :: Type
r = RootAnn -> RootAnn -> Type -> Type -> T
TPair RootAnn
forall k (a :: k). Annotation a
noAnn RootAnn
forall k (a :: k). Annotation a
noAnn Type
l Type
r
tor :: Type -> Type -> T
tor :: Type -> Type -> T
tor l :: Type
l r :: Type
r = RootAnn -> RootAnn -> Type -> Type -> T
TOr RootAnn
forall k (a :: k). Annotation a
noAnn RootAnn
forall k (a :: k). Annotation a
noAnn Type
l Type
r
tyint :: Type
tyint :: Type
tyint = T -> TypeAnn -> Type
Type T
TInt TypeAnn
forall k (a :: k). Annotation a
noAnn
tynat :: Type
tynat :: Type
tynat = T -> TypeAnn -> Type
Type T
TNat TypeAnn
forall k (a :: k). Annotation a
noAnn
tyunit :: Type
tyunit :: Type
tyunit = T -> TypeAnn -> Type
Type T
TUnit TypeAnn
forall k (a :: k). Annotation a
noAnn
tybool :: Type
tybool :: Type
tybool = T -> TypeAnn -> Type
Type T
TBool TypeAnn
forall k (a :: k). Annotation a
noAnn
typair :: Type -> Type -> Type
typair :: Type -> Type -> Type
typair l :: Type
l r :: Type
r = T -> TypeAnn -> Type
Type (Type -> Type -> T
tpair Type
l Type
r) TypeAnn
forall k (a :: k). Annotation a
noAnn
tyor :: Type -> Type -> Type
tyor :: Type -> Type -> Type
tyor l :: Type
l r :: Type
r = T -> TypeAnn -> Type
Type (Type -> Type -> T
tor Type
l Type
r) TypeAnn
forall k (a :: k). Annotation a
noAnn
tyImplicitAccountParam :: Type
tyImplicitAccountParam :: Type
tyImplicitAccountParam = T -> TypeAnn -> Type
Type T
TUnit TypeAnn
forall k (a :: k). Annotation a
noAnn
isAtomicType :: Type -> Bool
isAtomicType :: Type -> Bool
isAtomicType t :: Type
t@(Type _ tAnn :: TypeAnn
tAnn) | TypeAnn
tAnn TypeAnn -> TypeAnn -> Bool
forall a. Eq a => a -> a -> Bool
== TypeAnn
forall k (a :: k). Annotation a
noAnn =
Type -> Bool
isComparable Type
t Bool -> Bool -> Bool
|| Type -> Bool
isKey Type
t Bool -> Bool -> Bool
|| Type -> Bool
isUnit Type
t Bool -> Bool -> Bool
|| Type -> Bool
isSignature Type
t Bool -> Bool -> Bool
|| Type -> Bool
isOperation Type
t
isAtomicType _ = Bool
False
isKey :: Type -> Bool
isKey :: Type -> Bool
isKey (Type TKey _) = Bool
True
isKey _ = Bool
False
isUnit :: Type -> Bool
isUnit :: Type -> Bool
isUnit (Type TUnit _) = Bool
True
isUnit _ = Bool
False
isSignature :: Type -> Bool
isSignature :: Type -> Bool
isSignature (Type TSignature _) = Bool
True
isSignature _ = Bool
False
isOperation :: Type -> Bool
isOperation :: Type -> Bool
isOperation (Type TOperation _) = Bool
True
isOperation _ = Bool
False
isComparable :: Type -> Bool
isComparable :: Type -> Bool
isComparable (Type t :: T
t _) = case T
t of
TInt -> Bool
True
TNat -> Bool
True
TString -> Bool
True
TBytes -> Bool
True
TMutez -> Bool
True
TBool -> Bool
True
TKeyHash -> Bool
True
TTimestamp -> Bool
True
TAddress -> Bool
True
_ -> Bool
False
isMutez :: Type -> Bool
isMutez :: Type -> Bool
isMutez (Type TMutez _) = Bool
True
isMutez _ = Bool
False
isTimestamp :: Type -> Bool
isTimestamp :: Type -> Bool
isTimestamp (Type TTimestamp _) = Bool
True
isTimestamp _ = Bool
False
isKeyHash :: Type -> Bool
isKeyHash :: Type -> Bool
isKeyHash (Type TKeyHash _) = Bool
True
isKeyHash _ = Bool
False
isBool :: Type -> Bool
isBool :: Type -> Bool
isBool (Type TBool _) = Bool
True
isBool _ = Bool
False
isString :: Type -> Bool
isString :: Type -> Bool
isString (Type TString _) = Bool
True
isString _ = Bool
False
isInteger :: Type -> Bool
isInteger :: Type -> Bool
isInteger a :: Type
a = Type -> Bool
isNat Type
a Bool -> Bool -> Bool
|| Type -> Bool
isInt Type
a Bool -> Bool -> Bool
|| Type -> Bool
isMutez Type
a Bool -> Bool -> Bool
|| Type -> Bool
isTimestamp Type
a
isNat :: Type -> Bool
isNat :: Type -> Bool
isNat (Type TNat _) = Bool
True
isNat _ = Bool
False
isInt :: Type -> Bool
isInt :: Type -> Bool
isInt (Type TInt _) = Bool
True
isInt _ = Bool
False
isBytes :: Type -> Bool
isBytes :: Type -> Bool
isBytes (Type TBytes _) = Bool
True
isBytes _ = Bool
False
deriveJSON morleyAesonOptions ''Type
deriveJSON morleyAesonOptions ''T
deriveJSON morleyAesonOptions ''ParameterType
deriveLift ''Type
deriveLift ''T
deriveLift ''ParameterType