{-# LANGUAGE DeriveLift #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Morley.Michelson.Typed.Annotation
( Notes (..)
, AnnConvergeError(..)
, converge
, convergeAnns
, convergeDestrAnns
, insertTypeAnn
, isStar
, starNotes
, mkUType
, notesSing
, notesT
) where
import Data.Singletons (Sing, SingI(..), fromSing)
import Fmt (Buildable(..), (+|), (|+))
import Language.Haskell.TH.Lift (Lift)
import Morley.Michelson.Printer.Util (RenderDoc(..), buildRenderDoc)
import Morley.Michelson.Typed.Sing
import Morley.Michelson.Typed.T (T(..))
import Morley.Michelson.Untyped qualified as Un
import Morley.Michelson.Untyped.Annotation
(Annotation, FieldAnn, TypeAnn, VarAnn, convergeVarAnns, noAnn, unifyAnn, unifyPairFieldAnn)
import Morley.Util.Peano qualified as Peano
import Morley.Util.PeanoNatural (singPeanoVal)
import Morley.Util.TH
import Morley.Util.Typeable
{-# ANN module ("HLint: ignore Avoid lambda using `infix`" :: Text) #-}
data Notes t where
NTKey :: TypeAnn -> Notes 'TKey
NTUnit :: TypeAnn -> Notes 'TUnit
NTSignature :: TypeAnn -> Notes 'TSignature
NTChainId :: TypeAnn -> Notes 'TChainId
NTOption :: TypeAnn -> Notes t -> Notes ('TOption t)
NTList :: TypeAnn -> Notes t -> Notes ('TList t)
NTSet :: TypeAnn -> Notes t -> Notes ('TSet t)
NTOperation :: TypeAnn -> Notes 'TOperation
NTContract :: TypeAnn -> Notes t -> Notes ('TContract t)
NTTicket :: TypeAnn -> Notes t -> Notes ('TTicket t)
NTPair :: TypeAnn -> FieldAnn -> FieldAnn
-> VarAnn -> VarAnn
-> Notes p -> Notes q -> Notes ('TPair p q)
NTOr :: TypeAnn -> FieldAnn -> FieldAnn
-> Notes p -> Notes q -> Notes ('TOr p q)
NTLambda :: TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
NTMap :: TypeAnn -> Notes k -> Notes v -> Notes ('TMap k v)
NTBigMap :: TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
NTInt :: TypeAnn -> Notes 'TInt
NTNat :: TypeAnn -> Notes 'TNat
NTString :: TypeAnn -> Notes 'TString
NTBytes :: TypeAnn -> Notes 'TBytes
NTMutez :: TypeAnn -> Notes 'TMutez
NTBool :: TypeAnn -> Notes 'TBool
NTKeyHash :: TypeAnn -> Notes 'TKeyHash
NTBls12381Fr :: TypeAnn -> Notes 'TBls12381Fr
NTBls12381G1 :: TypeAnn -> Notes 'TBls12381G1
NTBls12381G2 :: TypeAnn -> Notes 'TBls12381G2
NTTimestamp :: TypeAnn -> Notes 'TTimestamp
NTAddress :: TypeAnn -> Notes 'TAddress
NTChest :: TypeAnn -> Notes 'TChest
NTChestKey :: TypeAnn -> Notes 'TChestKey
NTNever :: TypeAnn -> Notes 'TNever
NTSaplingState :: forall (n :: Peano.Peano). TypeAnn -> Sing n -> Notes ('TSaplingState n)
NTSaplingTransaction :: forall (n :: Peano.Peano). TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
deriving stock instance Eq (Notes t)
deriving stock instance Show (Notes t)
deriving stock instance Lift (Notes t)
$(deriveGADTNFData ''Notes)
instance Buildable (Notes t) where
build :: Notes t -> Builder
build = Notes t -> Builder
forall a. RenderDoc a => a -> Builder
buildRenderDoc
instance RenderDoc (Notes t) where
renderDoc :: RenderContext -> Notes t -> Doc
renderDoc RenderContext
pn = RenderContext -> Ty -> Doc
forall a. RenderDoc a => RenderContext -> a -> Doc
renderDoc RenderContext
pn (Ty -> Doc) -> (Notes t -> Ty) -> Notes t -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType
notesSing :: Notes t -> Sing t
notesSing :: Notes t -> Sing t
notesSing = \case
NTInt TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTNat TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTString TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTBytes TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTMutez TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTBool TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTKeyHash TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTBls12381Fr TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTBls12381G1 TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTBls12381G2 TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTTimestamp TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTAddress TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTKey TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTUnit TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTSignature TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTChainId TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTOption TypeAnn
_ Notes t
n -> Sing t -> SingT ('TOption t)
forall (n :: T). Sing n -> SingT ('TOption n)
STOption (Notes t -> Sing t
forall (t :: T). Notes t -> Sing t
notesSing Notes t
n)
NTList TypeAnn
_ Notes t
n -> Sing t -> SingT ('TList t)
forall (n :: T). Sing n -> SingT ('TList n)
STList (Notes t -> Sing t
forall (t :: T). Notes t -> Sing t
notesSing Notes t
n)
NTSet TypeAnn
_ Notes t
n -> Sing t -> SingT ('TSet t)
forall (n :: T). Sing n -> SingT ('TSet n)
STSet (Notes t -> Sing t
forall (t :: T). Notes t -> Sing t
notesSing Notes t
n)
NTOperation TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTChest TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTChestKey TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTNever TypeAnn
_ -> Sing t
forall k (a :: k). SingI a => Sing a
sing
NTSaplingState TypeAnn
_ Sing n
s -> Sing n -> SingT ('TSaplingState n)
forall (n :: Peano). Sing n -> SingT ('TSaplingState n)
STSaplingState Sing n
s
NTSaplingTransaction TypeAnn
_ Sing n
s -> Sing n -> SingT ('TSaplingTransaction n)
forall (n :: Peano). Sing n -> SingT ('TSaplingTransaction n)
STSaplingTransaction Sing n
s
NTContract TypeAnn
_ Notes t
n -> Sing t -> SingT ('TContract t)
forall (n :: T). Sing n -> SingT ('TContract n)
STContract (Notes t -> Sing t
forall (t :: T). Notes t -> Sing t
notesSing Notes t
n)
NTTicket TypeAnn
_ Notes t
n -> Sing t -> SingT ('TTicket t)
forall (n :: T). Sing n -> SingT ('TTicket n)
STTicket (Notes t -> Sing t
forall (t :: T). Notes t -> Sing t
notesSing Notes t
n)
NTPair TypeAnn
_ FieldAnn
_ FieldAnn
_ VarAnn
_ VarAnn
_ Notes p
l Notes q
r -> Sing p -> Sing q -> SingT ('TPair p q)
forall (n :: T) (n :: T). Sing n -> Sing n -> SingT ('TPair n n)
STPair (Notes p -> Sing p
forall (t :: T). Notes t -> Sing t
notesSing Notes p
l) (Notes q -> Sing q
forall (t :: T). Notes t -> Sing t
notesSing Notes q
r)
NTOr TypeAnn
_ FieldAnn
_ FieldAnn
_ Notes p
l Notes q
r -> Sing p -> Sing q -> SingT ('TOr p q)
forall (n :: T) (n :: T). Sing n -> Sing n -> SingT ('TOr n n)
STOr (Notes p -> Sing p
forall (t :: T). Notes t -> Sing t
notesSing Notes p
l) (Notes q -> Sing q
forall (t :: T). Notes t -> Sing t
notesSing Notes q
r)
NTLambda TypeAnn
_ Notes p
l Notes q
r -> Sing p -> Sing q -> SingT ('TLambda p q)
forall (n :: T) (n :: T). Sing n -> Sing n -> SingT ('TLambda n n)
STLambda (Notes p -> Sing p
forall (t :: T). Notes t -> Sing t
notesSing Notes p
l) (Notes q -> Sing q
forall (t :: T). Notes t -> Sing t
notesSing Notes q
r)
NTMap TypeAnn
_ Notes k
l Notes v
r -> Sing k -> Sing v -> SingT ('TMap k v)
forall (n :: T) (n :: T). Sing n -> Sing n -> SingT ('TMap n n)
STMap (Notes k -> Sing k
forall (t :: T). Notes t -> Sing t
notesSing Notes k
l) (Notes v -> Sing v
forall (t :: T). Notes t -> Sing t
notesSing Notes v
r)
NTBigMap TypeAnn
_ Notes k
l Notes v
r -> Sing k -> Sing v -> SingT ('TBigMap k v)
forall (n :: T) (n :: T). Sing n -> Sing n -> SingT ('TBigMap n n)
STBigMap (Notes k -> Sing k
forall (t :: T). Notes t -> Sing t
notesSing Notes k
l) (Notes v -> Sing v
forall (t :: T). Notes t -> Sing t
notesSing Notes v
r)
notesT :: Notes t -> T
notesT :: Notes t -> T
notesT = SingT t -> T
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing (SingT t -> T) -> (Notes t -> SingT t) -> Notes t -> T
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Notes t -> SingT t
forall (t :: T). Notes t -> Sing t
notesSing
mkUType :: Notes x -> Un.Ty
mkUType :: Notes x -> Ty
mkUType = \case
NTInt TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TInt TypeAnn
tn
NTNat TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TNat TypeAnn
tn
NTString TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TString TypeAnn
tn
NTBytes TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TBytes TypeAnn
tn
NTMutez TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TMutez TypeAnn
tn
NTBool TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TBool TypeAnn
tn
NTKeyHash TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TKeyHash TypeAnn
tn
NTBls12381Fr TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TBls12381Fr TypeAnn
tn
NTBls12381G1 TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TBls12381G1 TypeAnn
tn
NTBls12381G2 TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TBls12381G2 TypeAnn
tn
NTTimestamp TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TTimestamp TypeAnn
tn
NTAddress TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TAddress TypeAnn
tn
NTKey TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TKey TypeAnn
tn
NTUnit TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TUnit TypeAnn
tn
NTSignature TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TSignature TypeAnn
tn
NTChainId TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TChainId TypeAnn
tn
NTOption TypeAnn
tn Notes t
n -> T -> TypeAnn -> Ty
Un.Ty (Ty -> T
Un.TOption (Ty -> T) -> Ty -> T
forall a b. (a -> b) -> a -> b
$ Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes t
n) TypeAnn
tn
NTList TypeAnn
tn Notes t
n -> T -> TypeAnn -> Ty
Un.Ty (Ty -> T
Un.TList (Ty -> T) -> Ty -> T
forall a b. (a -> b) -> a -> b
$ Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes t
n) TypeAnn
tn
NTSet TypeAnn
tn Notes t
n -> T -> TypeAnn -> Ty
Un.Ty (Ty -> T
Un.TSet (Ty -> T) -> Ty -> T
forall a b. (a -> b) -> a -> b
$ Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes t
n) TypeAnn
tn
NTOperation TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TOperation TypeAnn
tn
NTChest TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TChest TypeAnn
tn
NTChestKey TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TChestKey TypeAnn
tn
NTNever TypeAnn
tn -> T -> TypeAnn -> Ty
Un.Ty T
Un.TNever TypeAnn
tn
NTSaplingState TypeAnn
tn Sing n
s -> T -> TypeAnn -> Ty
Un.Ty (Natural -> T
Un.TSaplingState (SingNat n -> Natural
forall (n :: Peano). SingNat n -> Natural
singPeanoVal Sing n
SingNat n
s)) TypeAnn
tn
NTSaplingTransaction TypeAnn
tn Sing n
s -> T -> TypeAnn -> Ty
Un.Ty (Natural -> T
Un.TSaplingState (SingNat n -> Natural
forall (n :: Peano). SingNat n -> Natural
singPeanoVal Sing n
SingNat n
s)) TypeAnn
tn
NTContract TypeAnn
tn Notes t
n -> T -> TypeAnn -> Ty
Un.Ty (Ty -> T
Un.TContract (Ty -> T) -> Ty -> T
forall a b. (a -> b) -> a -> b
$ Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes t
n) TypeAnn
tn
NTTicket TypeAnn
tn Notes t
n -> T -> TypeAnn -> Ty
Un.Ty (Ty -> T
Un.TTicket (Ty -> T) -> Ty -> T
forall a b. (a -> b) -> a -> b
$ Notes t -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes t
n) TypeAnn
tn
NTPair TypeAnn
tn FieldAnn
fl FieldAnn
fr VarAnn
vl VarAnn
vr Notes p
nl Notes q
nr ->
T -> TypeAnn -> Ty
Un.Ty (FieldAnn -> FieldAnn -> VarAnn -> VarAnn -> Ty -> Ty -> T
Un.TPair FieldAnn
fl FieldAnn
fr VarAnn
vl VarAnn
vr (Notes p -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes p
nl) (Notes q -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes q
nr)) TypeAnn
tn
NTOr TypeAnn
tn FieldAnn
fl FieldAnn
fr Notes p
nl Notes q
nr -> T -> TypeAnn -> Ty
Un.Ty (FieldAnn -> FieldAnn -> Ty -> Ty -> T
Un.TOr FieldAnn
fl FieldAnn
fr (Notes p -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes p
nl) (Notes q -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes q
nr)) TypeAnn
tn
NTLambda TypeAnn
tn Notes p
np Notes q
nq -> T -> TypeAnn -> Ty
Un.Ty (Ty -> Ty -> T
Un.TLambda (Notes p -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes p
np) (Notes q -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes q
nq)) TypeAnn
tn
NTMap TypeAnn
tn Notes k
nk Notes v
nv -> T -> TypeAnn -> Ty
Un.Ty (Ty -> Ty -> T
Un.TMap (Notes k -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes k
nk) (Notes v -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes v
nv)) TypeAnn
tn
NTBigMap TypeAnn
tn Notes k
nk Notes v
nv -> T -> TypeAnn -> Ty
Un.Ty (Ty -> Ty -> T
Un.TBigMap (Notes k -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes k
nk) (Notes v -> Ty
forall (x :: T). Notes x -> Ty
mkUType Notes v
nv)) TypeAnn
tn
starNotes :: forall t. SingI t => Notes t
starNotes :: Notes t
starNotes = Sing t -> Notes t
forall (t :: T). Sing t -> Notes t
starNotes' Sing t
forall k (a :: k). SingI a => Sing a
sing
starNotes' :: Sing t -> Notes t
starNotes' :: Sing t -> Notes t
starNotes' = \case
Sing t
STInt -> TypeAnn -> Notes 'TInt
NTInt TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STNat -> TypeAnn -> Notes 'TNat
NTNat TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STString -> TypeAnn -> Notes 'TString
NTString TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STBytes -> TypeAnn -> Notes 'TBytes
NTBytes TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STMutez -> TypeAnn -> Notes 'TMutez
NTMutez TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STBool -> TypeAnn -> Notes 'TBool
NTBool TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STKeyHash -> TypeAnn -> Notes 'TKeyHash
NTKeyHash TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STBls12381Fr -> TypeAnn -> Notes 'TBls12381Fr
NTBls12381Fr TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STBls12381G1 -> TypeAnn -> Notes 'TBls12381G1
NTBls12381G1 TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STBls12381G2 -> TypeAnn -> Notes 'TBls12381G2
NTBls12381G2 TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STTimestamp -> TypeAnn -> Notes 'TTimestamp
NTTimestamp TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STAddress -> TypeAnn -> Notes 'TAddress
NTAddress TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STKey -> TypeAnn -> Notes 'TKey
NTKey TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STUnit -> TypeAnn -> Notes 'TUnit
NTUnit TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STNever -> TypeAnn -> Notes 'TNever
NTNever TypeAnn
forall k (a :: k). Annotation a
noAnn
STSaplingState s -> TypeAnn -> Sing n -> Notes ('TSaplingState n)
forall (v :: Peano). TypeAnn -> Sing v -> Notes ('TSaplingState v)
NTSaplingState TypeAnn
forall k (a :: k). Annotation a
noAnn Sing n
s
STSaplingTransaction s -> TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
forall (n :: Peano).
TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
NTSaplingTransaction TypeAnn
forall k (a :: k). Annotation a
noAnn Sing n
s
Sing t
STSignature -> TypeAnn -> Notes 'TSignature
NTSignature TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STChainId -> TypeAnn -> Notes 'TChainId
NTChainId TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STOperation -> TypeAnn -> Notes 'TOperation
NTOperation TypeAnn
forall k (a :: k). Annotation a
noAnn
STSet t -> TypeAnn -> Notes n -> Notes ('TSet n)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TSet t)
NTSet TypeAnn
forall k (a :: k). Annotation a
noAnn (Notes n -> Notes ('TSet n)) -> Notes n -> Notes ('TSet n)
forall a b. (a -> b) -> a -> b
$ Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t
STList t -> TypeAnn -> Notes n -> Notes ('TList n)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TList t)
NTList TypeAnn
forall k (a :: k). Annotation a
noAnn (Notes n -> Notes ('TList n)) -> Notes n -> Notes ('TList n)
forall a b. (a -> b) -> a -> b
$ Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t
STOption t -> TypeAnn -> Notes n -> Notes ('TOption n)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TOption t)
NTOption TypeAnn
forall k (a :: k). Annotation a
noAnn (Notes n -> Notes ('TOption n)) -> Notes n -> Notes ('TOption n)
forall a b. (a -> b) -> a -> b
$ Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t
STContract t -> TypeAnn -> Notes n -> Notes ('TContract n)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TContract t)
NTContract TypeAnn
forall k (a :: k). Annotation a
noAnn (Notes n -> Notes ('TContract n))
-> Notes n -> Notes ('TContract n)
forall a b. (a -> b) -> a -> b
$ Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t
STTicket t -> TypeAnn -> Notes n -> Notes ('TTicket n)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TTicket t)
NTTicket TypeAnn
forall k (a :: k). Annotation a
noAnn (Notes n -> Notes ('TTicket n)) -> Notes n -> Notes ('TTicket n)
forall a b. (a -> b) -> a -> b
$ Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t
STMap t t' -> TypeAnn -> Notes n -> Notes n -> Notes ('TMap n n)
forall (q :: T) (k :: T).
TypeAnn -> Notes q -> Notes k -> Notes ('TMap q k)
NTMap TypeAnn
forall k (a :: k). Annotation a
noAnn (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t) (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t')
STBigMap t t' -> TypeAnn -> Notes n -> Notes n -> Notes ('TBigMap n n)
forall (k :: T) (v :: T).
TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
NTBigMap TypeAnn
forall k (a :: k). Annotation a
noAnn (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t) (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t')
STPair t t' ->
TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes n
-> Notes n
-> Notes ('TPair n n)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes p
-> Notes ('TPair p p)
NTPair TypeAnn
forall k (a :: k). Annotation a
noAnn FieldAnn
forall k (a :: k). Annotation a
noAnn FieldAnn
forall k (a :: k). Annotation a
noAnn VarAnn
forall k (a :: k). Annotation a
noAnn VarAnn
forall k (a :: k). Annotation a
noAnn (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t) (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t')
STOr t t' -> TypeAnn
-> FieldAnn -> FieldAnn -> Notes n -> Notes n -> Notes ('TOr n n)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes p -> Notes ('TOr p p)
NTOr TypeAnn
forall k (a :: k). Annotation a
noAnn FieldAnn
forall k (a :: k). Annotation a
noAnn FieldAnn
forall k (a :: k). Annotation a
noAnn (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t) (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t')
STLambda t t' -> TypeAnn -> Notes n -> Notes n -> Notes ('TLambda n n)
forall (p :: T) (q :: T).
TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
NTLambda TypeAnn
forall k (a :: k). Annotation a
noAnn (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t) (Sing n -> Notes n
forall (t :: T). Sing t -> Notes t
starNotes' Sing n
t')
Sing t
STChest -> TypeAnn -> Notes 'TChest
NTChest TypeAnn
forall k (a :: k). Annotation a
noAnn
Sing t
STChestKey -> TypeAnn -> Notes 'TChestKey
NTChestKey TypeAnn
forall k (a :: k). Annotation a
noAnn
isStar :: SingI t => Notes t -> Bool
isStar :: Notes t -> Bool
isStar = (Notes t -> Notes t -> Bool
forall a. Eq a => a -> a -> Bool
== Notes t
forall (t :: T). SingI t => Notes t
starNotes)
converge :: Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge :: Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n1 Notes t
n2 = case (Notes t
n1, Notes t
n2) of
(NTInt TypeAnn
a, NTInt TypeAnn
b) -> TypeAnn -> Notes 'TInt
NTInt (TypeAnn -> Notes 'TInt)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TInt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTNat TypeAnn
a, NTNat TypeAnn
b) -> TypeAnn -> Notes 'TNat
NTNat (TypeAnn -> Notes 'TNat)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TNat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTString TypeAnn
a, NTString TypeAnn
b) -> TypeAnn -> Notes 'TString
NTString (TypeAnn -> Notes 'TString)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTBytes TypeAnn
a, NTBytes TypeAnn
b) -> TypeAnn -> Notes 'TBytes
NTBytes (TypeAnn -> Notes 'TBytes)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TBytes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTMutez TypeAnn
a, NTMutez TypeAnn
b) -> TypeAnn -> Notes 'TMutez
NTMutez (TypeAnn -> Notes 'TMutez)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TMutez)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTBool TypeAnn
a, NTBool TypeAnn
b) -> TypeAnn -> Notes 'TBool
NTBool (TypeAnn -> Notes 'TBool)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TBool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTKeyHash TypeAnn
a, NTKeyHash TypeAnn
b) -> TypeAnn -> Notes 'TKeyHash
NTKeyHash (TypeAnn -> Notes 'TKeyHash)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TKeyHash)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTBls12381Fr TypeAnn
a, NTBls12381Fr TypeAnn
b) -> TypeAnn -> Notes 'TBls12381Fr
NTBls12381Fr (TypeAnn -> Notes 'TBls12381Fr)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TBls12381Fr)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTBls12381G1 TypeAnn
a, NTBls12381G1 TypeAnn
b) -> TypeAnn -> Notes 'TBls12381G1
NTBls12381G1 (TypeAnn -> Notes 'TBls12381G1)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TBls12381G1)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTBls12381G2 TypeAnn
a, NTBls12381G2 TypeAnn
b) -> TypeAnn -> Notes 'TBls12381G2
NTBls12381G2 (TypeAnn -> Notes 'TBls12381G2)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TBls12381G2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTTimestamp TypeAnn
a, NTTimestamp TypeAnn
b) -> TypeAnn -> Notes 'TTimestamp
NTTimestamp (TypeAnn -> Notes 'TTimestamp)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TTimestamp)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTAddress TypeAnn
a, NTAddress TypeAnn
b) -> TypeAnn -> Notes 'TAddress
NTAddress (TypeAnn -> Notes 'TAddress)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TAddress)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTKey TypeAnn
a, NTKey TypeAnn
b) -> TypeAnn -> Notes 'TKey
NTKey (TypeAnn -> Notes 'TKey)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTUnit TypeAnn
a, NTUnit TypeAnn
b) -> TypeAnn -> Notes 'TUnit
NTUnit (TypeAnn -> Notes 'TUnit)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TUnit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTChest TypeAnn
a, NTChest TypeAnn
b) -> TypeAnn -> Notes 'TChest
NTChest (TypeAnn -> Notes 'TChest)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TChest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTChestKey TypeAnn
a, NTChestKey TypeAnn
b) -> TypeAnn -> Notes 'TChestKey
NTChestKey (TypeAnn -> Notes 'TChestKey)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TChestKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTNever TypeAnn
a, NTNever TypeAnn
b) -> TypeAnn -> Notes 'TNever
NTNever (TypeAnn -> Notes 'TNever)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TNever)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTSaplingState TypeAnn
a Sing n
_, NTSaplingState TypeAnn
b Sing n
s) ->
(\TypeAnn
c -> TypeAnn -> Sing n -> Notes ('TSaplingState n)
forall (v :: Peano). TypeAnn -> Sing v -> Notes ('TSaplingState v)
NTSaplingState TypeAnn
c Sing n
Sing n
s) (TypeAnn -> Notes ('TSaplingState n))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes ('TSaplingState n))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTSaplingTransaction TypeAnn
a Sing n
_, NTSaplingTransaction TypeAnn
b Sing n
s) ->
(\TypeAnn
c -> TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
forall (n :: Peano).
TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
NTSaplingTransaction TypeAnn
c Sing n
Sing n
s) (TypeAnn -> Notes ('TSaplingTransaction n))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes ('TSaplingTransaction n))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTSignature TypeAnn
a, NTSignature TypeAnn
b) ->
TypeAnn -> Notes 'TSignature
NTSignature (TypeAnn -> Notes 'TSignature)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TSignature)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTChainId TypeAnn
a, NTChainId TypeAnn
b) ->
TypeAnn -> Notes 'TChainId
NTChainId (TypeAnn -> Notes 'TChainId)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TChainId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTOption TypeAnn
a Notes t
n, NTOption TypeAnn
b Notes t
m) ->
TypeAnn -> Notes t -> Notes ('TOption t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TOption t)
NTOption (TypeAnn -> Notes t -> Notes ('TOption t))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes t -> Notes ('TOption t))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes t -> Notes ('TOption t))
-> Either AnnConvergeError (Notes t)
-> Either AnnConvergeError (Notes ('TOption t))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes t -> Notes t -> Either AnnConvergeError (Notes t)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n Notes t
Notes t
m
(NTList TypeAnn
a Notes t
n, NTList TypeAnn
b Notes t
m) ->
TypeAnn -> Notes t -> Notes ('TList t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TList t)
NTList (TypeAnn -> Notes t -> Notes ('TList t))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes t -> Notes ('TList t))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes t -> Notes ('TList t))
-> Either AnnConvergeError (Notes t)
-> Either AnnConvergeError (Notes ('TList t))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes t -> Notes t -> Either AnnConvergeError (Notes t)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n Notes t
Notes t
m
(NTSet TypeAnn
a Notes t
n, NTSet TypeAnn
b Notes t
m) ->
TypeAnn -> Notes t -> Notes ('TSet t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TSet t)
NTSet (TypeAnn -> Notes t -> Notes ('TSet t))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes t -> Notes ('TSet t))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes t -> Notes ('TSet t))
-> Either AnnConvergeError (Notes t)
-> Either AnnConvergeError (Notes ('TSet t))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes t -> Notes t -> Either AnnConvergeError (Notes t)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n Notes t
Notes t
m
(NTOperation TypeAnn
a, NTOperation TypeAnn
b) ->
TypeAnn -> Notes 'TOperation
NTOperation (TypeAnn -> Notes 'TOperation)
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes 'TOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
(NTContract TypeAnn
a Notes t
n, NTContract TypeAnn
b Notes t
m) ->
TypeAnn -> Notes t -> Notes ('TContract t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TContract t)
NTContract (TypeAnn -> Notes t -> Notes ('TContract t))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes t -> Notes ('TContract t))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes t -> Notes ('TContract t))
-> Either AnnConvergeError (Notes t)
-> Either AnnConvergeError (Notes ('TContract t))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes t -> Notes t -> Either AnnConvergeError (Notes t)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n Notes t
Notes t
m
(NTTicket TypeAnn
a Notes t
n, NTTicket TypeAnn
b Notes t
m) ->
TypeAnn -> Notes t -> Notes ('TTicket t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TTicket t)
NTTicket (TypeAnn -> Notes t -> Notes ('TTicket t))
-> Either AnnConvergeError TypeAnn
-> Either AnnConvergeError (Notes t -> Notes ('TTicket t))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes t -> Notes ('TTicket t))
-> Either AnnConvergeError (Notes t)
-> Either AnnConvergeError (Notes ('TTicket t))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes t -> Notes t -> Either AnnConvergeError (Notes t)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes t
n Notes t
Notes t
m
(NTPair TypeAnn
a FieldAnn
pF FieldAnn
qF VarAnn
pV VarAnn
qV Notes p
pN Notes q
qN, NTPair TypeAnn
b FieldAnn
pG FieldAnn
qG VarAnn
pW VarAnn
qW Notes p
pM Notes q
qM) ->
TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes q
-> Notes ('TPair p q)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes p
-> Notes ('TPair p p)
NTPair (TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes q
-> Notes ('TPair p q))
-> Either AnnConvergeError TypeAnn
-> Either
AnnConvergeError
(FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes q
-> Notes ('TPair p q))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b
Either
AnnConvergeError
(FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes q
-> Notes ('TPair p q))
-> Either AnnConvergeError FieldAnn
-> Either
AnnConvergeError
(FieldAnn
-> VarAnn -> VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns FieldAnn
pF FieldAnn
pG Either
AnnConvergeError
(FieldAnn
-> VarAnn -> VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
-> Either AnnConvergeError FieldAnn
-> Either
AnnConvergeError
(VarAnn -> VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns FieldAnn
qF FieldAnn
qG
Either
AnnConvergeError
(VarAnn -> VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
-> Either AnnConvergeError VarAnn
-> Either
AnnConvergeError
(VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> VarAnn -> Either AnnConvergeError VarAnn
forall (f :: * -> *) a. Applicative f => a -> f a
pure (VarAnn -> VarAnn -> VarAnn
convergeVarAnns VarAnn
pV VarAnn
pW) Either
AnnConvergeError
(VarAnn -> Notes p -> Notes q -> Notes ('TPair p q))
-> Either AnnConvergeError VarAnn
-> Either
AnnConvergeError (Notes p -> Notes q -> Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> VarAnn -> Either AnnConvergeError VarAnn
forall (f :: * -> *) a. Applicative f => a -> f a
pure (VarAnn -> VarAnn -> VarAnn
convergeVarAnns VarAnn
qV VarAnn
qW)
Either AnnConvergeError (Notes p -> Notes q -> Notes ('TPair p q))
-> Either AnnConvergeError (Notes p)
-> Either AnnConvergeError (Notes q -> Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes p -> Notes p -> Either AnnConvergeError (Notes p)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes p
pN Notes p
Notes p
pM Either AnnConvergeError (Notes q -> Notes ('TPair p q))
-> Either AnnConvergeError (Notes q)
-> Either AnnConvergeError (Notes ('TPair p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes q -> Notes q -> Either AnnConvergeError (Notes q)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes q
qN Notes q
Notes q
qM
(NTOr TypeAnn
a FieldAnn
pF FieldAnn
qF Notes p
pN Notes q
qN, NTOr TypeAnn
b FieldAnn
pG FieldAnn
qG Notes p
pM Notes q
qM) ->
TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes p -> Notes ('TOr p p)
NTOr (TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q))
-> Either AnnConvergeError TypeAnn
-> Either
AnnConvergeError
(FieldAnn -> FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either
AnnConvergeError
(FieldAnn -> FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q))
-> Either AnnConvergeError FieldAnn
-> Either
AnnConvergeError
(FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns FieldAnn
pF FieldAnn
pG Either
AnnConvergeError
(FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q))
-> Either AnnConvergeError FieldAnn
-> Either AnnConvergeError (Notes p -> Notes q -> Notes ('TOr p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns FieldAnn
qF FieldAnn
qG
Either AnnConvergeError (Notes p -> Notes q -> Notes ('TOr p q))
-> Either AnnConvergeError (Notes p)
-> Either AnnConvergeError (Notes q -> Notes ('TOr p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes p -> Notes p -> Either AnnConvergeError (Notes p)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes p
pN Notes p
Notes p
pM Either AnnConvergeError (Notes q -> Notes ('TOr p q))
-> Either AnnConvergeError (Notes q)
-> Either AnnConvergeError (Notes ('TOr p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes q -> Notes q -> Either AnnConvergeError (Notes q)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes q
qN Notes q
Notes q
qM
(NTLambda TypeAnn
a Notes p
pN Notes q
qN, NTLambda TypeAnn
b Notes p
pM Notes q
qM) ->
TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
forall (p :: T) (q :: T).
TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
NTLambda (TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q))
-> Either AnnConvergeError TypeAnn
-> Either
AnnConvergeError (Notes p -> Notes q -> Notes ('TLambda p q))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either
AnnConvergeError (Notes p -> Notes q -> Notes ('TLambda p q))
-> Either AnnConvergeError (Notes p)
-> Either AnnConvergeError (Notes q -> Notes ('TLambda p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes p -> Notes p -> Either AnnConvergeError (Notes p)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes p
pN Notes p
Notes p
pM Either AnnConvergeError (Notes q -> Notes ('TLambda p q))
-> Either AnnConvergeError (Notes q)
-> Either AnnConvergeError (Notes ('TLambda p q))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes q -> Notes q -> Either AnnConvergeError (Notes q)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes q
qN Notes q
Notes q
qM
(NTMap TypeAnn
a Notes k
kN Notes v
vN, NTMap TypeAnn
b Notes k
kM Notes v
vM) ->
TypeAnn -> Notes k -> Notes v -> Notes ('TMap k v)
forall (q :: T) (k :: T).
TypeAnn -> Notes q -> Notes k -> Notes ('TMap q k)
NTMap (TypeAnn -> Notes k -> Notes v -> Notes ('TMap k v))
-> Either AnnConvergeError TypeAnn
-> Either
AnnConvergeError (Notes k -> Notes v -> Notes ('TMap k v))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either AnnConvergeError (Notes k -> Notes v -> Notes ('TMap k v))
-> Either AnnConvergeError (Notes k)
-> Either AnnConvergeError (Notes v -> Notes ('TMap k v))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes k -> Notes k -> Either AnnConvergeError (Notes k)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes k
kN Notes k
Notes k
kM Either AnnConvergeError (Notes v -> Notes ('TMap k v))
-> Either AnnConvergeError (Notes v)
-> Either AnnConvergeError (Notes ('TMap k v))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes v -> Notes v -> Either AnnConvergeError (Notes v)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes v
vN Notes v
Notes v
vM
(NTBigMap TypeAnn
a Notes k
kN Notes v
vN, NTBigMap TypeAnn
b Notes k
kM Notes v
vM) ->
TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
forall (k :: T) (v :: T).
TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
NTBigMap (TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v))
-> Either AnnConvergeError TypeAnn
-> Either
AnnConvergeError (Notes k -> Notes v -> Notes ('TBigMap k v))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeAnn -> TypeAnn -> Either AnnConvergeError TypeAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns TypeAnn
a TypeAnn
b Either
AnnConvergeError (Notes k -> Notes v -> Notes ('TBigMap k v))
-> Either AnnConvergeError (Notes k)
-> Either AnnConvergeError (Notes v -> Notes ('TBigMap k v))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes k -> Notes k -> Either AnnConvergeError (Notes k)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes k
kN Notes k
Notes k
kM Either AnnConvergeError (Notes v -> Notes ('TBigMap k v))
-> Either AnnConvergeError (Notes v)
-> Either AnnConvergeError (Notes ('TBigMap k v))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Notes v -> Notes v -> Either AnnConvergeError (Notes v)
forall (t :: T).
Notes t -> Notes t -> Either AnnConvergeError (Notes t)
converge Notes v
vN Notes v
Notes v
vM
insertTypeAnn :: forall (b :: T). TypeAnn -> Notes b -> Notes b
insertTypeAnn :: TypeAnn -> Notes b -> Notes b
insertTypeAnn TypeAnn
nt Notes b
s = case Notes b
s of
NTInt TypeAnn
_ -> TypeAnn -> Notes 'TInt
NTInt TypeAnn
nt
NTNat TypeAnn
_ -> TypeAnn -> Notes 'TNat
NTNat TypeAnn
nt
NTString TypeAnn
_ -> TypeAnn -> Notes 'TString
NTString TypeAnn
nt
NTBytes TypeAnn
_ -> TypeAnn -> Notes 'TBytes
NTBytes TypeAnn
nt
NTMutez TypeAnn
_ -> TypeAnn -> Notes 'TMutez
NTMutez TypeAnn
nt
NTBool TypeAnn
_ -> TypeAnn -> Notes 'TBool
NTBool TypeAnn
nt
NTKeyHash TypeAnn
_ -> TypeAnn -> Notes 'TKeyHash
NTKeyHash TypeAnn
nt
NTBls12381Fr TypeAnn
_ -> TypeAnn -> Notes 'TBls12381Fr
NTBls12381Fr TypeAnn
nt
NTBls12381G1 TypeAnn
_ -> TypeAnn -> Notes 'TBls12381G1
NTBls12381G1 TypeAnn
nt
NTBls12381G2 TypeAnn
_ -> TypeAnn -> Notes 'TBls12381G2
NTBls12381G2 TypeAnn
nt
NTTimestamp TypeAnn
_ -> TypeAnn -> Notes 'TTimestamp
NTTimestamp TypeAnn
nt
NTAddress TypeAnn
_ -> TypeAnn -> Notes 'TAddress
NTAddress TypeAnn
nt
NTKey TypeAnn
_ -> TypeAnn -> Notes 'TKey
NTKey TypeAnn
nt
NTUnit TypeAnn
_ -> TypeAnn -> Notes 'TUnit
NTUnit TypeAnn
nt
NTSignature TypeAnn
_ -> TypeAnn -> Notes 'TSignature
NTSignature TypeAnn
nt
NTOption TypeAnn
_ Notes t
n1 -> TypeAnn -> Notes t -> Notes ('TOption t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TOption t)
NTOption TypeAnn
nt Notes t
n1
NTList TypeAnn
_ Notes t
n1 -> TypeAnn -> Notes t -> Notes ('TList t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TList t)
NTList TypeAnn
nt Notes t
n1
NTSet TypeAnn
_ Notes t
n1 -> TypeAnn -> Notes t -> Notes ('TSet t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TSet t)
NTSet TypeAnn
nt Notes t
n1
NTOperation TypeAnn
_ -> TypeAnn -> Notes 'TOperation
NTOperation TypeAnn
nt
NTContract TypeAnn
_ Notes t
n1 -> TypeAnn -> Notes t -> Notes ('TContract t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TContract t)
NTContract TypeAnn
nt Notes t
n1
NTTicket TypeAnn
_ Notes t
n1 -> TypeAnn -> Notes t -> Notes ('TTicket t)
forall (t :: T). TypeAnn -> Notes t -> Notes ('TTicket t)
NTTicket TypeAnn
nt Notes t
n1
NTPair TypeAnn
_ FieldAnn
n1 FieldAnn
n2 VarAnn
n3 VarAnn
n4 Notes p
n5 Notes q
n6 -> TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes q
-> Notes ('TPair p q)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn
-> FieldAnn
-> VarAnn
-> VarAnn
-> Notes p
-> Notes p
-> Notes ('TPair p p)
NTPair TypeAnn
nt FieldAnn
n1 FieldAnn
n2 VarAnn
n3 VarAnn
n4 Notes p
n5 Notes q
n6
NTOr TypeAnn
_ FieldAnn
n1 FieldAnn
n2 Notes p
n3 Notes q
n4 -> TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes q -> Notes ('TOr p q)
forall (p :: T) (p :: T).
TypeAnn
-> FieldAnn -> FieldAnn -> Notes p -> Notes p -> Notes ('TOr p p)
NTOr TypeAnn
nt FieldAnn
n1 FieldAnn
n2 Notes p
n3 Notes q
n4
NTLambda TypeAnn
_ Notes p
n1 Notes q
n2 -> TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
forall (p :: T) (q :: T).
TypeAnn -> Notes p -> Notes q -> Notes ('TLambda p q)
NTLambda TypeAnn
nt Notes p
n1 Notes q
n2
NTMap TypeAnn
_ Notes k
n1 Notes v
n2 -> TypeAnn -> Notes k -> Notes v -> Notes ('TMap k v)
forall (q :: T) (k :: T).
TypeAnn -> Notes q -> Notes k -> Notes ('TMap q k)
NTMap TypeAnn
nt Notes k
n1 Notes v
n2
NTBigMap TypeAnn
_ Notes k
n1 Notes v
n2 -> TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
forall (k :: T) (v :: T).
TypeAnn -> Notes k -> Notes v -> Notes ('TBigMap k v)
NTBigMap TypeAnn
nt Notes k
n1 Notes v
n2
NTChainId TypeAnn
_ -> TypeAnn -> Notes 'TChainId
NTChainId TypeAnn
nt
NTChest TypeAnn
_ -> TypeAnn -> Notes 'TChest
NTChest TypeAnn
nt
NTChestKey TypeAnn
_ -> TypeAnn -> Notes 'TChestKey
NTChestKey TypeAnn
nt
NTNever TypeAnn
_ -> TypeAnn -> Notes 'TNever
NTNever TypeAnn
nt
NTSaplingState TypeAnn
_ Sing n
n -> TypeAnn -> Sing n -> Notes ('TSaplingState n)
forall (v :: Peano). TypeAnn -> Sing v -> Notes ('TSaplingState v)
NTSaplingState TypeAnn
nt Sing n
n
NTSaplingTransaction TypeAnn
_ Sing n
n -> TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
forall (n :: Peano).
TypeAnn -> Sing n -> Notes ('TSaplingTransaction n)
NTSaplingTransaction TypeAnn
nt Sing n
n
data AnnConvergeError where
AnnConvergeError
:: forall (tag :: Type).
(Buildable (Annotation tag), Show (Annotation tag), Typeable tag)
=> Annotation tag -> Annotation tag -> AnnConvergeError
deriving stock instance Show AnnConvergeError
instance Eq AnnConvergeError where
AnnConvergeError Annotation tag
ann1 Annotation tag
ann2 == :: AnnConvergeError -> AnnConvergeError -> Bool
== AnnConvergeError Annotation tag
ann1' Annotation tag
ann2' =
(Annotation tag
ann1 Annotation tag -> Annotation tag -> Bool
forall k (a1 :: k) (a2 :: k) (t :: k -> *).
(Typeable a1, Typeable a2, Eq (t a1)) =>
t a1 -> t a2 -> Bool
`eqParam1` Annotation tag
ann1') Bool -> Bool -> Bool
forall a. Boolean a => a -> a -> a
&& (Annotation tag
ann2 Annotation tag -> Annotation tag -> Bool
forall k (a1 :: k) (a2 :: k) (t :: k -> *).
(Typeable a1, Typeable a2, Eq (t a1)) =>
t a1 -> t a2 -> Bool
`eqParam1` Annotation tag
ann2')
instance Buildable AnnConvergeError where
build :: AnnConvergeError -> Builder
build (AnnConvergeError Annotation tag
ann1 Annotation tag
ann2) =
Builder
"Annotations do not converge: " Builder -> Builder -> Builder
forall b. FromBuilder b => Builder -> Builder -> b
+| Annotation tag
ann1 Annotation tag -> Builder -> Builder
forall a b. (Buildable a, FromBuilder b) => a -> Builder -> b
|+ Builder
" /= " Builder -> Builder -> Builder
forall b. FromBuilder b => Builder -> Builder -> b
+| Annotation tag
ann2 Annotation tag -> Builder -> Builder
forall a b. (Buildable a, FromBuilder b) => a -> Builder -> b
|+ Builder
""
convergeAnnsImpl
:: forall (tag :: Type).
(Buildable (Annotation tag), Show (Annotation tag), Typeable tag)
=> (Annotation tag -> Annotation tag -> Maybe (Annotation tag))
-> Annotation tag -> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnnsImpl :: (Annotation tag -> Annotation tag -> Maybe (Annotation tag))
-> Annotation tag
-> Annotation tag
-> Either AnnConvergeError (Annotation tag)
convergeAnnsImpl Annotation tag -> Annotation tag -> Maybe (Annotation tag)
unify Annotation tag
a Annotation tag
b = Either AnnConvergeError (Annotation tag)
-> (Annotation tag -> Either AnnConvergeError (Annotation tag))
-> Maybe (Annotation tag)
-> Either AnnConvergeError (Annotation tag)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (AnnConvergeError -> Either AnnConvergeError (Annotation tag)
forall a b. a -> Either a b
Left (AnnConvergeError -> Either AnnConvergeError (Annotation tag))
-> AnnConvergeError -> Either AnnConvergeError (Annotation tag)
forall a b. (a -> b) -> a -> b
$ Annotation tag -> Annotation tag -> AnnConvergeError
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
Annotation tag -> Annotation tag -> AnnConvergeError
AnnConvergeError Annotation tag
a Annotation tag
b) Annotation tag -> Either AnnConvergeError (Annotation tag)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe (Annotation tag)
-> Either AnnConvergeError (Annotation tag))
-> Maybe (Annotation tag)
-> Either AnnConvergeError (Annotation tag)
forall a b. (a -> b) -> a -> b
$ Annotation tag -> Annotation tag -> Maybe (Annotation tag)
unify Annotation tag
a Annotation tag
b
convergeAnns
:: forall (tag :: Type).
(Buildable (Annotation tag), Show (Annotation tag), Typeable tag)
=> Annotation tag -> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns :: Annotation tag
-> Annotation tag -> Either AnnConvergeError (Annotation tag)
convergeAnns = (Annotation tag -> Annotation tag -> Maybe (Annotation tag))
-> Annotation tag
-> Annotation tag
-> Either AnnConvergeError (Annotation tag)
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
(Annotation tag -> Annotation tag -> Maybe (Annotation tag))
-> Annotation tag
-> Annotation tag
-> Either AnnConvergeError (Annotation tag)
convergeAnnsImpl Annotation tag -> Annotation tag -> Maybe (Annotation tag)
forall k (tag :: k).
Annotation tag -> Annotation tag -> Maybe (Annotation tag)
unifyAnn
convergeDestrAnns :: FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
convergeDestrAnns :: FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
convergeDestrAnns = (FieldAnn -> FieldAnn -> Maybe FieldAnn)
-> FieldAnn -> FieldAnn -> Either AnnConvergeError FieldAnn
forall tag.
(Buildable (Annotation tag), Show (Annotation tag),
Typeable tag) =>
(Annotation tag -> Annotation tag -> Maybe (Annotation tag))
-> Annotation tag
-> Annotation tag
-> Either AnnConvergeError (Annotation tag)
convergeAnnsImpl FieldAnn -> FieldAnn -> Maybe FieldAnn
unifyPairFieldAnn
$(deriveGADTNFData ''AnnConvergeError)