accessor_core

Accessors for Core types, for use with the Accessor library
IN THIS PACKAGE
Module Accessor_core . Map
include module type of Accessor_base.Map
val at : 'key -> ( _, 'data Base.option, ( 'key, 'data, _ ) Base.Map.t, [< Accessor_base__Import.field ] ) Accessor.t

If key maps to some data in the map being accessed, at key accesses Some data, otherwise it accesses None. You can use at key to determine or control whether there is a mapping for key at all. For example, Accessor.set (at key) map None removes any mapping for key in map.

val ati : 'key -> ( 'key * _, 'data Base.option, ( 'key, 'data, _ ) Base.Map.t, [< Accessor_base__Import.field ] ) Accessor.Indexed.t

ati is the indexed version of at. The index is simply whatever key was supplied as an argument.

val found : 'key -> ( _, 'data, ( 'key, 'data, _ ) Base.Map.t, [< Accessor_base__Import.optional ] ) Accessor.t

found key is like at key, but it does not give any control over whether key exists in the map. It either accesses the data or it doesn't, depending on whether it exists.

val foundi : 'key -> ( 'key * _, 'data, ( 'key, 'data, _ ) Base.Map.t, [< Accessor_base__Import.optional ] ) Accessor.Indexed.t

foundi is the indexed version of found. The index is simply whatever key was supplied as an argument.

val each : ( 'i -> 'a -> 'b, 'i -> ( 'k, 'a, 'cmp ) Base.Map.t -> ( 'k, 'b, 'cmp ) Base.Map.t, [< Accessor_base__Import.many ] ) Accessor.General.t

each accesses each datum in the map.

val eachi : ( ('k * 'i) -> 'a -> 'b, 'i -> ( 'k, 'a, 'cmp ) Base.Map.t -> ( 'k, 'b, 'cmp ) Base.Map.t, [< Accessor_base__Import.many ] ) Accessor.General.t

eachi is the indexed version of each. The indices are the keys that map to the data being accessed.

val each_in_subrange : lower_bound:'k Base.Maybe_bound.t -> upper_bound:'k Base.Maybe_bound.t -> ( _, 'a, ( 'k, 'a, _ ) Base.Map.t, [< Accessor_base__Import.many ] ) Accessor.t

Like each, but only accesses data within the specified subrange of keys.

val each_in_subrangei : lower_bound:'k Base.Maybe_bound.t -> upper_bound:'k Base.Maybe_bound.t -> ( 'k * _, 'a, ( 'k, 'a, _ ) Base.Map.t, [< Accessor_base__Import.many ] ) Accessor.Indexed.t

Like eachi, but only accesses data within the specified subrange of keys.

val empty_default : ( 'k1, 'cmp1 ) Base.Comparator.Module.t -> ( 'i -> ( 'k1, 'a, 'cmp1 ) Base.Map.t -> ( 'k2, 'b, 'cmp2 ) Base.Map.t, 'i -> ( 'k1, 'a, 'cmp1 ) Base.Map.t Base.option -> ( 'k2, 'b, 'cmp2 ) Base.Map.t Base.option, [< Accessor_base__Import.isomorphism ] ) Accessor.General.t

empty_default (module M) is an isomorphism between Map.t option and Map.t, treating None identically with Map.empty (module M). Note that this isn't well-behaved in general because it doesn't satisfy construct (get a) = a:

construct (get (Some (Map.empty (module M))))
= construct (Map.empty (module M))
= None
val of_accessor : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> [ `Duplicate_key of 'k | `Ok of ( 'k, 'a, 'cmp ) Base.Map.t ]

of_accessor (module M) accessor x ~key_of_index is a M.Map.t created by traversing x with accessor, mapping each index to the data being accessed.

val of_accessor_exn : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> ( 'k, 'a, 'cmp ) Base.Map.t

Raising version of of_accessor.

val of_accessor_or_error : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> ( 'k, 'a, 'cmp ) Base.Map.t Base.Or_error.t

Or_error version of of_accessor.

val of_accessor_fold : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> init:'acc -> f:( 'acc -> 'a -> 'acc ) -> ( 'k, 'acc, 'cmp ) Base.Map.t

A version of of_accessor that allows you to accumulate multiple values per key with a function.

val of_accessor_multi : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> ( 'k, 'a Base.list, 'cmp ) Base.Map.t

A version of of_accessor that allows you to collect multiple values per key into a list.

val of_accessor_reduce : ( 'k, 'cmp ) Base.Comparator.Module.t -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__Import.many_getter ] ) Accessor.General.t -> 'at -> key_of_index:( 'i Accessor.Index.t -> 'k ) -> f:( 'a -> 'a -> 'a ) -> ( 'k, 'a, 'cmp ) Base.Map.t

A version of of_accessor that allows you to combine multiple values per key with a function.

include Accessor.Applicative_without_return.S3 with type ('data, 'key, 'cmp) t := ( 'key, 'data, 'cmp ) Base.Map.t
val map : ( Base.unit -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Accessor.Subtyping.nonempty ] ) Accessor.General.t -> 'at -> f:( 'a -> ( 'd, 'b, 'e ) Base.Map.t ) -> ( 'd, 'bt, 'e ) Base.Map.t
val mapi : ( 'i -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Accessor.Subtyping.nonempty ] ) Accessor.General.t -> 'at -> f:( 'i Accessor.Index.t -> 'a -> ( 'd, 'b, 'e ) Base.Map.t ) -> ( 'd, 'bt, 'e ) Base.Map.t
val iter : ( Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'a -> ( 'd, Base.unit, 'e ) Base.Map.t ) -> ( 'd, Base.unit, 'e ) Base.Map.t
val iteri : ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'i Accessor.Index.t -> 'a -> ( 'd, Base.unit, 'e ) Base.Map.t ) -> ( 'd, Base.unit, 'e ) Base.Map.t
val sum : (module Base.Container.Summable with type t = 'sum) -> ( Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'a -> ( 'd, 'sum, 'e ) Base.Map.t ) -> ( 'd, 'sum, 'e ) Base.Map.t
val sumi : (module Base.Container.Summable with type t = 'sum) -> ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'i Accessor.Index.t -> 'a -> ( 'd, 'sum, 'e ) Base.Map.t ) -> ( 'd, 'sum, 'e ) Base.Map.t
val count : ( Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'a -> ( 'd, Base.bool, 'e ) Base.Map.t ) -> ( 'd, Base.int, 'e ) Base.Map.t
val counti : ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> f:( 'i Accessor.Index.t -> 'a -> ( 'd, Base.bool, 'e ) Base.Map.t ) -> ( 'd, Base.int, 'e ) Base.Map.t
val all : ( Base.unit -> ( 'd, 'a, 'e ) Base.Map.t -> 'a, Base.unit -> 'at -> 'bt, [> Accessor.Subtyping.nonempty ] ) Accessor.General.t -> 'at -> ( 'd, 'bt, 'e ) Base.Map.t
val all_unit : ( Base.unit -> ( 'd, Base.unit, 'e ) Base.Map.t -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> ( 'd, Base.unit, 'e ) Base.Map.t
val map_reduce_nonempty : ( Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> combine:( 'b -> 'b -> 'b ) -> f:( 'a -> ( 'd, 'b, 'e ) Base.Map.t ) -> ( 'd, 'b, 'e ) Base.Map.t
val map_reduce_nonemptyi : ( 'i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ] ) Accessor.General.t -> 'at -> combine:( 'b -> 'b -> 'b ) -> f:( 'i Accessor.Index.t -> 'a -> ( 'd, 'b, 'e ) Base.Map.t ) -> ( 'd, 'b, 'e ) Base.Map.t
val at_key_set : ( 'key, _ ) Core.Set.t -> ( _, 'data option, ( 'key, 'data, _ ) Core.Map.t, [< Accessor_core__Import.many ] ) Accessor_base.t

at_key_set keys is like at key, but it accesses multiple keys.

val at_key_seti : ( 'key, _ ) Core.Set.t -> ( 'key * _, 'data option, ( 'key, 'data, _ ) Core.Map.t, [< Accessor_core__Import.many ] ) Accessor_base.Indexed.t

at_key_seti keys is like ati key, but it accesses multiple keys.

val found_key_set : ( 'key, _ ) Core.Set.t -> ( _, 'data, ( 'key, 'data, _ ) Core.Map.t, [< Accessor_core__Import.many ] ) Accessor_base.t

found_key_set keys is like found key, but it accesses multiple keys.

val found_key_seti : ( 'key, _ ) Core.Set.t -> ( 'key * _, 'data, ( 'key, 'data, _ ) Core.Map.t, [< Accessor_core__Import.many ] ) Accessor_base.Indexed.t

found_key_seti keys is like foundi key, but it accesses multiple keys.