{-# LANGUAGE TemplateHaskell #-} -- | Module, containing CValue data type -- which represents Michelson comparable values. module Michelson.Typed.CValue ( CValue (..) ) where import Michelson.Text import Michelson.Typed.EntryPoints import Michelson.Typed.T (CT(..)) import Tezos.Core (Mutez, Timestamp) import Tezos.Crypto (KeyHash) import Util.TH -- | Representation of comparable value -- in Michelson language. -- -- By specification, we're allowed to compare -- only following types: int, nat, string, bytes, -- mutez, bool, key_hash, timestamp, address. -- -- Only these values can be used as map keys -- or set elements. data CValue t where CvInt :: Integer -> CValue 'CInt CvNat :: Natural -> CValue 'CNat CvString :: MText -> CValue 'CString CvBytes :: ByteString -> CValue 'CBytes CvMutez :: Mutez -> CValue 'CMutez CvBool :: Bool -> CValue 'CBool CvKeyHash :: KeyHash -> CValue 'CKeyHash CvTimestamp :: Timestamp -> CValue 'CTimestamp CvAddress :: EpAddress -> CValue 'CAddress deriving stock instance Show (CValue t) deriving stock instance Eq (CValue t) deriving stock instance Ord (CValue t) $(deriveGADTNFData ''CValue)