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

Michelson.Interpret

Contents

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
Show InterpreterState Source # 
Instance details

Defined in Michelson.Interpret

Generic InterpreterState Source # 
Instance details

Defined in Michelson.Interpret

Associated Types

type Rep InterpreterState :: Type -> Type #

NFData InterpreterState Source # 
Instance details

Defined in Michelson.Interpret

Methods

rnf :: InterpreterState -> () #

type Rep InterpreterState Source # 
Instance details

Defined in Michelson.Interpret

type Rep InterpreterState = D1 ('MetaData "InterpreterState" "Michelson.Interpret" "morley-1.7.0-inplace" 'False) (C1 ('MetaCons "InterpreterState" 'PrefixI 'True) (S1 ('MetaSel ('Just "isMorleyLogs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MorleyLogs) :*: (S1 ('MetaSel ('Just "isRemainingSteps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RemainingSteps) :*: S1 ('MetaSel ('Just "isOriginationNonce") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 OriginationIndex))))

data MichelsonFailed where Source #

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

Instances

Instances details
Eq MichelsonFailed Source # 
Instance details

Defined in Michelson.Interpret

Show MichelsonFailed Source # 
Instance details

Defined in Michelson.Interpret

NFData MichelsonFailed Source # 
Instance details

Defined in Michelson.Interpret

Methods

rnf :: MichelsonFailed -> () #

Buildable MichelsonFailed Source # 
Instance details

Defined in Michelson.Interpret

newtype RemainingSteps Source #

Constructors

RemainingSteps Word64 

Instances

Instances details
Eq RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Num RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Ord RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Show RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Generic RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Associated Types

type Rep RemainingSteps :: Type -> Type #

NFData RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

Methods

rnf :: RemainingSteps -> () #

Buildable RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

type Rep RemainingSteps Source # 
Instance details

Defined in Michelson.Interpret

type Rep RemainingSteps = D1 ('MetaData "RemainingSteps" "Michelson.Interpret" "morley-1.7.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 Value inp -> SomeItStack 

newtype MorleyLogs Source #

Morley logs for interpreter state.

Constructors

MorleyLogs 

Fields

Instances

Instances details
Eq MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Show MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Generic MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Associated Types

type Rep MorleyLogs :: Type -> Type #

NFData MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Methods

rnf :: MorleyLogs -> () #

Default MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Methods

def :: MorleyLogs #

Buildable MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

Methods

build :: MorleyLogs -> Builder #

type Rep MorleyLogs Source # 
Instance details

Defined in Michelson.Interpret

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

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

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

Mostly for testing purposes.

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

newtype InterpretError Source #

Instances

Instances details
Show InterpretError Source # 
Instance details

Defined in Michelson.Interpret

Generic InterpretError Source # 
Instance details

Defined in Michelson.Interpret

Associated Types

type Rep InterpretError :: Type -> Type #

Buildable InterpretError Source # 
Instance details

Defined in Michelson.Interpret

type Rep InterpretError Source # 
Instance details

Defined in Michelson.Interpret

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

data InterpretResult where Source #

Constructors

InterpretResult 

Fields

Instances

Instances details
Show InterpretResult Source # 
Instance details

Defined in Michelson.Interpret

type InstrRunner m = forall inp out. Instr inp out -> Rec Value inp -> m (Rec Value 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 :: EvalM m => InstrRunner m -> InstrRunner m Source #

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