morley-1.8.1: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Michelson.Typed.Value

Description

Module, containing data types for Michelson value.

Synopsis

Documentation

data SomeValue' instr where Source #

Constructors

SomeValue :: KnownT t => Value' instr t -> SomeValue' instr 

Instances

Instances details
Eq (SomeValue' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: SomeValue' instr -> SomeValue' instr -> Bool #

(/=) :: SomeValue' instr -> SomeValue' instr -> Bool #

Show (SomeValue' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> SomeValue' instr -> ShowS #

show :: SomeValue' instr -> String #

showList :: [SomeValue' instr] -> ShowS #

data SomeConstrainedValue' instr (c :: T -> Constraint) where Source #

Constructors

SomeConstrainedValue :: forall (t :: T) (c :: T -> Constraint) instr. c t => Value' instr t -> SomeConstrainedValue' instr c 

Instances

Instances details
Show (SomeConstrainedValue' instr c) Source # 
Instance details

Defined in Michelson.Typed.Value

data Comparability t where Source #

Constructors

CanBeCompared :: Comparable t => Comparability t 
CannotBeCompared :: IsComparable t ~ 'False => Comparability t 

class IsComparable t ~ 'True => Comparable t Source #

Minimal complete definition

tcompare

Instances

Instances details
Comparable 'TInt Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TInt -> Value' instr 'TInt -> Ordering

Comparable 'TNat Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TNat -> Value' instr 'TNat -> Ordering

Comparable 'TString Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TString -> Value' instr 'TString -> Ordering

Comparable 'TBytes Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TBytes -> Value' instr 'TBytes -> Ordering

Comparable 'TMutez Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TMutez -> Value' instr 'TMutez -> Ordering

Comparable 'TBool Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TBool -> Value' instr 'TBool -> Ordering

Comparable 'TKeyHash Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TKeyHash -> Value' instr 'TKeyHash -> Ordering

Comparable 'TTimestamp Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TTimestamp -> Value' instr 'TTimestamp -> Ordering

Comparable 'TAddress Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr 'TAddress -> Value' instr 'TAddress -> Ordering

KnownT t => CheckScope (ComparabilityScope t) Source # 
Instance details

Defined in Michelson.Typed.Value

SingI t => CheckScope (Comparable t) Source # 
Instance details

Defined in Michelson.Typed.Value

(Comparable e1, Comparable e2) => Comparable ('TPair e1 e2) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

tcompare :: forall (instr :: [T] -> [T] -> Type). Value' instr ('TPair e1 e2) -> Value' instr ('TPair e1 e2) -> Ordering

type ComparabilityScope t = (KnownT t, Comparable t) Source #

Alias for comparable types.

type ContractInp1 param st = 'TPair param st Source #

type ContractInp param st = '[ContractInp1 param st] Source #

data CreateContract instr cp st Source #

Constructors

(Show (instr (ContractInp cp st) (ContractOut st)), Eq (instr (ContractInp cp st) (ContractOut st))) => CreateContract 

Instances

Instances details
Eq (CreateContract instr cp st) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: CreateContract instr cp st -> CreateContract instr cp st -> Bool #

(/=) :: CreateContract instr cp st -> CreateContract instr cp st -> Bool #

Show (CreateContract instr cp st) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> CreateContract instr cp st -> ShowS #

show :: CreateContract instr cp st -> String #

showList :: [CreateContract instr cp st] -> ShowS #

NFData (instr (ContractInp cp st) (ContractOut st)) => NFData (CreateContract instr cp st) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: CreateContract instr cp st -> () #

Buildable (CreateContract instr cp st) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

build :: CreateContract instr cp st -> Builder #

data Operation' instr where Source #

Data type, representing operation, list of which is returned by Michelson contract (according to calling convention).

These operations are to be further executed against system state after the contract execution.

Constructors

OpTransferTokens :: ParameterScope p => TransferTokens instr p -> Operation' instr 
OpSetDelegate :: SetDelegate -> Operation' instr 
OpCreateContract :: (Show (instr (ContractInp cp st) (ContractOut st)), NFData (instr (ContractInp cp st) (ContractOut st)), Typeable instr, ParameterScope cp, StorageScope st) => CreateContract instr cp st -> Operation' instr 

Instances

Instances details
IsoValue Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

Associated Types

type ToT Operation :: T Source #

TypeHasDoc Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

Eq (Operation' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: Operation' instr -> Operation' instr -> Bool #

(/=) :: Operation' instr -> Operation' instr -> Bool #

Show (Operation' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> Operation' instr -> ShowS #

show :: Operation' instr -> String #

showList :: [Operation' instr] -> ShowS #

NFData (Operation' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: Operation' instr -> () #

Buildable (Operation' instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

build :: Operation' instr -> Builder #

type ToT Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Value

type TypeDocFieldDescriptions Operation Source # 
Instance details

Defined in Michelson.Typed.Haskell.Doc

data SetDelegate Source #

Constructors

SetDelegate 

Instances

Instances details
Eq SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

Show SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

Generic SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

Associated Types

type Rep SetDelegate :: Type -> Type #

NFData SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: SetDelegate -> () #

Buildable SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

build :: SetDelegate -> Builder #

type Rep SetDelegate Source # 
Instance details

Defined in Michelson.Typed.Value

type Rep SetDelegate = D1 ('MetaData "SetDelegate" "Michelson.Typed.Value" "morley-1.8.1-inplace" 'False) (C1 ('MetaCons "SetDelegate" 'PrefixI 'True) (S1 ('MetaSel ('Just "sdMbKeyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe KeyHash))))

data TransferTokens instr p Source #

Constructors

TransferTokens 

Fields

Instances

Instances details
Eq (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: TransferTokens instr p -> TransferTokens instr p -> Bool #

(/=) :: TransferTokens instr p -> TransferTokens instr p -> Bool #

Show (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> TransferTokens instr p -> ShowS #

show :: TransferTokens instr p -> String #

showList :: [TransferTokens instr p] -> ShowS #

Generic (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

Associated Types

type Rep (TransferTokens instr p) :: Type -> Type #

Methods

from :: TransferTokens instr p -> Rep (TransferTokens instr p) x #

to :: Rep (TransferTokens instr p) x -> TransferTokens instr p #

NFData (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: TransferTokens instr p -> () #

Buildable (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

build :: TransferTokens instr p -> Builder #

type Rep (TransferTokens instr p) Source # 
Instance details

Defined in Michelson.Typed.Value

type Rep (TransferTokens instr p) = D1 ('MetaData "TransferTokens" "Michelson.Typed.Value" "morley-1.8.1-inplace" 'False) (C1 ('MetaCons "TransferTokens" 'PrefixI 'True) (S1 ('MetaSel ('Just "ttTransferArgument") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Value' instr p)) :*: (S1 ('MetaSel ('Just "ttAmount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Mutez) :*: S1 ('MetaSel ('Just "ttContract") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Value' instr ('TContract p))))))

data Value' instr t where Source #

Representation of Michelson value.

Type parameter instr stands for Michelson instruction type, i.e. data type to represent an instruction of language.

Constructors

VKey :: PublicKey -> Value' instr 'TKey 
VUnit :: Value' instr 'TUnit 
VSignature :: Signature -> Value' instr 'TSignature 
VChainId :: ChainId -> Value' instr 'TChainId 
VOption :: forall t instr. KnownT t => Maybe (Value' instr t) -> Value' instr ('TOption t) 
VList :: forall t instr. KnownT t => [Value' instr t] -> Value' instr ('TList t) 
VSet :: forall t instr. (KnownT t, Comparable t) => Set (Value' instr t) -> Value' instr ('TSet t) 
VOp :: Operation' instr -> Value' instr 'TOperation 
VContract :: forall arg instr. Address -> SomeEntrypointCallT arg -> Value' instr ('TContract arg) 
VPair :: forall l r instr. (Value' instr l, Value' instr r) -> Value' instr ('TPair l r) 
VOr :: forall l r instr. (KnownT l, KnownT r) => Either (Value' instr l) (Value' instr r) -> Value' instr ('TOr l r) 
VLam :: forall inp out instr. (KnownT inp, KnownT out, forall i o. Show (instr i o), forall i o. Eq (instr i o), forall i o. NFData (instr i o)) => RemFail instr (inp ': '[]) (out ': '[]) -> Value' instr ('TLambda inp out) 
VMap :: forall k v instr. (KnownT k, KnownT v, Comparable k) => Map (Value' instr k) (Value' instr v) -> Value' instr ('TMap k v) 
VBigMap :: forall k v instr. (KnownT k, KnownT v, Comparable k) => Map (Value' instr k) (Value' instr v) -> Value' instr ('TBigMap k v) 
VInt :: Integer -> Value' instr 'TInt 
VNat :: Natural -> Value' instr 'TNat 
VString :: MText -> Value' instr 'TString 
VBytes :: ByteString -> Value' instr 'TBytes 
VMutez :: Mutez -> Value' instr 'TMutez 
VBool :: Bool -> Value' instr 'TBool 
VKeyHash :: KeyHash -> Value' instr 'TKeyHash 
VTimestamp :: Timestamp -> Value' instr 'TTimestamp 
VAddress :: EpAddress -> Value' instr 'TAddress 

Instances

Instances details
UnpackedValScope t => FromExpression (Value t) Source # 
Instance details

Defined in Morley.Micheline.Class

(SingI t, HasNoOp t) => ToExpression (Value t) Source # 
Instance details

Defined in Morley.Micheline.Class

Eq (Value' instr t) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: Value' instr t -> Value' instr t -> Bool #

(/=) :: Value' instr t -> Value' instr t -> Bool #

Comparable e => Ord (Value' instr e) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

compare :: Value' instr e -> Value' instr e -> Ordering #

(<) :: Value' instr e -> Value' instr e -> Bool #

(<=) :: Value' instr e -> Value' instr e -> Bool #

(>) :: Value' instr e -> Value' instr e -> Bool #

(>=) :: Value' instr e -> Value' instr e -> Bool #

max :: Value' instr e -> Value' instr e -> Value' instr e #

min :: Value' instr e -> Value' instr e -> Value' instr e #

Show (Value' instr t) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> Value' instr t -> ShowS #

show :: Value' instr t -> String #

showList :: [Value' instr t] -> ShowS #

NFData (Value' t instr) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: Value' t instr -> () #

(SingI t, HasNoOp t) => Buildable (Value' Instr t) Source # 
Instance details

Defined in Michelson.Typed.Convert

Methods

build :: Value' Instr t -> Builder #

data RemFail (instr :: k -> k -> Type) (i :: k) (o :: k) where Source #

Wrapper over instruction which remembers whether this instruction always fails or not.

Constructors

RfNormal :: instr i o -> RemFail instr i o 
RfAlwaysFails :: (forall o'. instr i o') -> RemFail instr i o 

Instances

Instances details
Eq (instr i o) => Eq (RemFail instr i o) Source #

Ignoring distinction between constructors here, comparing only semantics.

Instance details

Defined in Michelson.Typed.Value

Methods

(==) :: RemFail instr i o -> RemFail instr i o -> Bool #

(/=) :: RemFail instr i o -> RemFail instr i o -> Bool #

(forall (o' :: k). Show (instr i o')) => Show (RemFail instr i o) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

showsPrec :: Int -> RemFail instr i o -> ShowS #

show :: RemFail instr i o -> String #

showList :: [RemFail instr i o] -> ShowS #

(forall (o' :: k). NFData (instr i o')) => NFData (RemFail instr i o) Source # 
Instance details

Defined in Michelson.Typed.Value

Methods

rnf :: RemFail instr i o -> () #

rfMerge :: (forall o'. instr i1 o' -> instr i2 o' -> instr i3 o') -> RemFail instr i1 o -> RemFail instr i2 o -> RemFail instr i3 o Source #

Merge two execution branches.

rfAnyInstr :: RemFail instr i o -> instr i o Source #

Get code disregard whether it always fails or not.

rfMapAnyInstr :: (forall o'. instr i1 o' -> instr i2 o') -> RemFail instr i1 o -> RemFail instr i2 o Source #

Modify inner code.

addressToVContract :: forall t instr. (ParameterScope t, ForbidOr t) => Address -> Value' instr ('TContract t) Source #

Make value of contract type which refers to the given address and does not call any entrypoint.

compileEpLiftSequence :: EpLiftSequence arg param -> Value' instr arg -> Value' instr param Source #

Turn EpLiftSequence into actual function on Values.

liftCallArg :: EntrypointCallT param arg -> Value' instr arg -> Value' instr param Source #

Lift entrypoint argument to full parameter.

valueTypeSanity :: Value' instr t -> Dict (KnownT t) Source #

Get a witness of that value's type is known.

Note that we cannot pick such witness out of nowhere as not all types of kind T have Typeable and SingI instances; example:

type family Any :: T where
  -- nothing here

withValueTypeSanity :: Value' instr t -> (KnownT t => a) -> a Source #

Provide a witness of that value's type is known.

eqValueExt :: Value' instr t1 -> Value' instr t2 -> Bool Source #

Extended values comparison - it does not require Values to be of the same type, only their content to match.