Mavryk_raw_protocol_001_PtAtLas.Script_map
Functions to ease the manipulation of Michelson maps.
A map in Michelson is a type-homegeneous, partial function of keys to values, along with the functions that operate on the structure (through a first-class module).
val make :
(module Script_typed_ir.Boxed_map
with type key = 'key
and type value = 'value) ->
('key, 'value) Script_typed_ir.map
val get_module :
('key, 'value) Script_typed_ir.map ->
(module Script_typed_ir.Boxed_map
with type key = 'key
and type value = 'value)
val empty : 'a Script_typed_ir.comparable_ty -> ('a, 'b) Script_typed_ir.map
empty cmp_ty
creates a map module where keys have size Gas_comparable_input_size.size_of_comparable_value cmp_ty
and are compared with Script_comparable.compare_comparable cmp_ty
(used for sorting keys, which ensures a reasonable complexity of the map functions). The function returns an empty map packaged as a first-class map module.
val empty_from : ('a, 'b) Script_typed_ir.map -> ('a, 'c) Script_typed_ir.map
empty_from map
creates an empty map module where the size of keys and the comparison function are those of map
.
val fold :
('key -> 'value -> 'acc -> 'acc) ->
('key, 'value) Script_typed_ir.map ->
'acc ->
'acc
val fold_es :
('key ->
'value ->
'acc ->
'acc Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t) ->
('key, 'value) Script_typed_ir.map ->
'acc ->
'acc Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t
val update :
'a ->
'b option ->
('a, 'b) Script_typed_ir.map ->
('a, 'b) Script_typed_ir.map
update k (Some v) map
associates v
to k
in map
(overwriting the previous value, if any), and update k None map
removes the potential association to k
in map
.
val mem : 'key -> ('key, 'value) Script_typed_ir.map -> bool
val get : 'key -> ('key, 'value) Script_typed_ir.map -> 'value option
val size : ('a, 'b) Script_typed_ir.map -> Script_int.n Script_int.num
val map_es_in_context :
('context ->
'key ->
'value1 ->
('value2 * 'context)
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t) ->
'context ->
('key, 'value1) Script_typed_ir.map ->
(('key, 'value2) Script_typed_ir.map * 'context)
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t