package accessor_core

  1. Overview
  2. Docs
include module type of Accessor_base.Map
val at : 'key -> (_, 'data Base.option, ('key, 'data, 'cmp) Base.Map.t, [< Accessor_base__.Import.field ]) Accessor.Simple.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 * 'i) -> 'data Base.option -> 'data Base.option, 'i -> ('key, 'data, 'cmp) Base.Map.t -> ('key, 'data, 'cmp) Base.Map.t, [< Accessor_base__.Import.field ]) Accessor.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, 'cmp) Base.Map.t, [< Accessor_base__.Import.optional ]) Accessor.Simple.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 * 'i) -> 'data -> 'data, 'i -> ('key, 'data, 'cmp) Base.Map.t -> ('key, 'data, 'cmp) Base.Map.t, [< Accessor_base__.Import.optional ]) Accessor.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.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.t

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

val empty_default : ('k1, 'cmp1) Base.Map.comparator -> ('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.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.Map.comparator -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor_base__.Import.many_getter ]) Accessor.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.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.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.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.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.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.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.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.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.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.t -> 'at -> ('d, Base.unit, 'e) Base.Map.t
val map_reduce_nonempty : (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.nonempty_getter ]) Accessor.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.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_kernel.Set.t -> (_, 'data option, ('key, 'data, _) Core_kernel.Map.t, [< Accessor_core__.Import.many ]) Accessor_base.Simple.t

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

val at_key_seti : ('key, _) Core_kernel.Set.t -> (('key * 'i) -> 'data option -> 'data option, 'i -> ('key, 'data, 'cmp) Core_kernel.Map.t -> ('key, 'data, 'cmp) Core_kernel.Map.t, [< Accessor_core__.Import.many ]) Accessor_base.t

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

val found_key_set : ('key, _) Core_kernel.Set.t -> (_, 'data, ('key, 'data, _) Core_kernel.Map.t, [< Accessor_core__.Import.many ]) Accessor_base.Simple.t

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

val found_key_seti : ('key, _) Core_kernel.Set.t -> (('key * 'i) -> 'data -> 'data, 'i -> ('key, 'data, 'cmp) Core_kernel.Map.t -> ('key, 'data, 'cmp) Core_kernel.Map.t, [< Accessor_core__.Import.many ]) Accessor_base.t

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

OCaml

Innovation. Community. Security.