morley-1.18.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Interpret

Description

Module, containing function to interpret Michelson instructions against given context and input stack.

Synopsis

Documentation

data ContractEnv Source #

Environment for contract execution.

Constructors

ContractEnv 

Fields

data InterpreterState Source #

Instances

Instances details
Generic InterpreterState Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep InterpreterState :: Type -> Type #

Show InterpreterState Source # 
Instance details

Defined in Morley.Michelson.Interpret

NFData InterpreterState Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

rnf :: InterpreterState -> () #

Monad m => InterpreterStateMonad (StateT InterpreterState m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

(Monad m, Monoid w) => InterpreterStateMonad (RWST r w InterpreterState m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep InterpreterState Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep InterpreterState = D1 ('MetaData "InterpreterState" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'False) (C1 ('MetaCons "InterpreterState" 'PrefixI 'True) (S1 ('MetaSel ('Just "isRemainingSteps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RemainingSteps) :*: (S1 ('MetaSel ('Just "isGlobalCounter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 GlobalCounter) :*: S1 ('MetaSel ('Just "isBigMapCounter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 BigMapCounter))))

data MichelsonFailed where Source #

Represents [FAILED] state of a Michelson program. Contains value that was on top of the stack when FAILWITH was called.

data MichelsonFailureWithStack Source #

Carries a MichelsonFailed error and the ErrorSrcPos at which it was raised

Instances

Instances details
Generic MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep MichelsonFailureWithStack :: Type -> Type #

Show MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

NFData MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

Buildable MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

Eq MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep MichelsonFailureWithStack Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep MichelsonFailureWithStack = D1 ('MetaData "MichelsonFailureWithStack" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'False) (C1 ('MetaCons "MichelsonFailureWithStack" 'PrefixI 'True) (S1 ('MetaSel ('Just "mfwsFailed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MichelsonFailed) :*: S1 ('MetaSel ('Just "mfwsErrorSrcPos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ErrorSrcPos)))

newtype RemainingSteps Source #

Constructors

RemainingSteps Word64 

Instances

Instances details
Generic RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep RemainingSteps :: Type -> Type #

Num RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

Show RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

NFData RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

rnf :: RemainingSteps -> () #

Buildable RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

Eq RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

Ord RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep RemainingSteps Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep RemainingSteps = D1 ('MetaData "RemainingSteps" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'True) (C1 ('MetaCons "RemainingSteps" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

data SomeItStack where Source #

Constructors

SomeItStack :: ExtInstr inp -> Rec StkEl inp -> SomeItStack 

newtype MorleyLogs Source #

Morley logs appearing as interpreter result.

Constructors

MorleyLogs 

Fields

Instances

Instances details
Monoid MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

Semigroup MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

Generic MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep MorleyLogs :: Type -> Type #

Show MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

NFData MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

rnf :: MorleyLogs -> () #

Buildable MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

build :: MorleyLogs -> Builder #

Eq MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep MorleyLogs Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep MorleyLogs = D1 ('MetaData "MorleyLogs" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'True) (C1 ('MetaCons "MorleyLogs" 'PrefixI 'True) (S1 ('MetaSel ('Just "unMorleyLogs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

newtype MorleyLogsBuilder Source #

Morley logs accumulator, for incremental building.

Constructors

MorleyLogsBuilder (Endo [Text]) 

Instances

Instances details
Monoid MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

Semigroup MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

Generic MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep MorleyLogsBuilder :: Type -> Type #

Default MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

One MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type OneItem MorleyLogsBuilder #

type Rep MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep MorleyLogsBuilder = D1 ('MetaData "MorleyLogsBuilder" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'True) (C1 ('MetaCons "MorleyLogsBuilder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Endo [Text]))))
type OneItem MorleyLogsBuilder Source # 
Instance details

Defined in Morley.Michelson.Interpret

interpretInstr :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailureWithStack (Rec Value out) Source #

Interpret an instruction in vacuum, putting no extra constraints on its execution.

Mostly for testing purposes.

interpretInstrAnnotated :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailureWithStack (Rec StkEl out) Source #

Interpret an instruction in vacuum, putting no extra constraints on its execution while preserving its annotations.

Mostly for testing purposes.

mkInitStack :: Value param -> Value st -> Rec StkEl (ContractInp param st) Source #

newtype InterpretError Source #

Instances

Instances details
Generic InterpretError Source # 
Instance details

Defined in Morley.Michelson.Interpret

Associated Types

type Rep InterpretError :: Type -> Type #

Show InterpretError Source # 
Instance details

Defined in Morley.Michelson.Interpret

Buildable InterpretError Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep InterpretError Source # 
Instance details

Defined in Morley.Michelson.Interpret

type Rep InterpretError = D1 ('MetaData "InterpretError" "Morley.Michelson.Interpret" "morley-1.18.0-inplace" 'True) (C1 ('MetaCons "InterpretError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MichelsonFailureWithStack, MorleyLogs))))

data InterpretResult where Source #

Constructors

InterpretResult 

Fields

Instances

Instances details
Show InterpretResult Source # 
Instance details

Defined in Morley.Michelson.Interpret

class Monad m => InterpreterStateMonad m where Source #

Minimal complete definition

Nothing

Instances

Instances details
InterpreterStateMonad m => InterpreterStateMonad (ExceptT e m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

InterpreterStateMonad m => InterpreterStateMonad (ReaderT r m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

Monad m => InterpreterStateMonad (StateT InterpreterState m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

InterpreterStateMonad m => InterpreterStateMonad (StateT w m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

(InterpreterStateMonad m, Monoid w) => InterpreterStateMonad (WriterT w m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

(Monad m, Monoid w) => InterpreterStateMonad (RWST r w InterpreterState m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

(InterpreterStateMonad m, Monoid w) => InterpreterStateMonad (RWST r w s m) Source # 
Instance details

Defined in Morley.Michelson.Interpret

newtype StkEl t Source #

Constructors

StkEl 

Fields

Instances

Instances details
Show (StkEl t) Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

showsPrec :: Int -> StkEl t -> ShowS #

show :: StkEl t -> String #

showList :: [StkEl t] -> ShowS #

Eq (StkEl t) Source # 
Instance details

Defined in Morley.Michelson.Interpret

Methods

(==) :: StkEl t -> StkEl t -> Bool #

(/=) :: StkEl t -> StkEl t -> Bool #

type InstrRunner m = forall inp out. Instr inp out -> Rec StkEl inp -> m (Rec StkEl out) Source #

runInstr :: EvalM m => InstrRunner m Source #

Function to change amount of remaining steps stored in State monad.

runUnpack :: forall t. UnpackedValScope t => ByteString -> Either UnpackError (Value t) Source #

Unpacks given raw data into a typed value.

Internals

runInstrImpl :: forall m. EvalM m => InstrRunner m -> InstrRunner m Source #

Function to interpret Michelson instruction(s) against given stack.

assignBigMapIds Source #

Arguments

:: MonadState BigMapCounter m 
=> Bool

If true, assign a new ID even if the bigmap already has one. Otherwise, assign IDs only to bigmaps that don't have one yet.

-> Value t 
-> m (Value t) 

All big_maps stored in a chain have a globally unique ID.

We use this function to assign a new ID whenever a big_map is created.

Prisms