package tezos-protocol-015-PtLimaPt

  1. Overview
  2. Docs
Tezos/Protocol: economic-protocol definition

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-16.0.tar.gz
sha256=ad9e08819871c75ba6f4530b125f7d157799398e4d77a1e6bfea9d91ff37ff55
sha512=c5dc4d40cc09bc6980fbbdb5c2e105bf4252cf9cfcb2b49660b0ebe4dc789f6709ec3b3bf2f87d81580d3eed9521eeb1c960f24d9b14eb0285aaba1f84d10a9b

doc/tezos-protocol-015-PtLimaPt.raw/Tezos_raw_protocol_015_PtLimaPt/Gas_monad/index.html

Module Tezos_raw_protocol_015_PtLimaPt.Gas_monadSource

Sourcetype ('a, 'trace) t

This monad combines:

  • a state monad where the state is the context
  • two levels of error monad to distinguish gas exhaustion from other errors

It is useful for backtracking on type checking errors without backtracking the consumed gas.

Sourcetype ('a, 'trace) gas_monad = ('a, 'trace) t

Alias of ('a, 'trace) t to avoid confusion when the module is open

Sourceval return : 'a -> ('a, 'trace) t

return x returns a value in the gas-monad.

Sourceval map : ('a -> 'b) -> ('a, 'trace) t -> ('b, 'trace) t

map f m maps over successful results of m using f.

Sourceval bind : ('a, 'trace) t -> ('a -> ('b, 'trace) t) -> ('b, 'trace) t

bind m f binds successful results of m and feeds it to f.

Sourceval bind_recover : ('a, 'trace) t -> (('a, 'trace) Tezos_protocol_environment_015_PtLimaPt.Pervasives.result -> ('b, 'trace') t) -> ('b, 'trace') t

bind_recover m f binds the result of m and feeds it to f. It's another variant of bind that allows recovery from inner errors.

Sourceval of_result : ('a, 'trace) Tezos_protocol_environment_015_PtLimaPt.Pervasives.result -> ('a, 'trace) t

of_result r is a gas-free embedding of the result r into the gas monad.

Sourceval consume_gas : Alpha_context.Gas.cost -> (unit, 'trace) t

consume_gas c consumes c amounts of gas. It's a wrapper around Gas.consume. If that fails, the whole computation within the gas-monad returns an error. See the Alpha_context.Gasmodule for details.

run ctxt m runs m using the given context and returns the result along with the new context with updated gas. The given context has unlimited mode enabled, through Gas.set_unlimited, no gas is consumed.

Sourceval record_trace_eval : error_details:('error_context, 'error_trace) Script_tc_errors.error_details -> ('error_context -> Tezos_protocol_environment_015_PtLimaPt.Error_monad.error) -> ('a, 'error_trace) t -> ('a, 'error_trace) t

record_trace_level ~error_details f m returns a new gas-monad value that when run, records trace levels using f. This function has no effect in the case of a gas-exhaustion error or if error_details is Fast.

Sourceval fail : 'trace -> ('a, 'trace) t

fail e is return (Error e) .

Sourcemodule Syntax : sig ... end

Syntax module for the Gas_monad. This is intended to be opened locally in functions. Within the scope of this module, the code can include binding operators, leading to a let-style syntax. Similar to Lwt_result_syntax and other syntax modules.

OCaml

Innovation. Community. Security.