Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
include sig ... end
include sig ... end
val none :
('a ->
unit ->
unit,
'a ->
'b Base.Option.t ->
'b Base.Option.t,
[< Accessor.variant ])
Accessor.t
val some :
('a ->
'b ->
'c,
'a ->
'b Base.Option.t ->
'c Base.Option.t,
[< Accessor.variant ])
Accessor.t
val default :
'a ->
is_default:('b -> Base.bool) ->
('i ->
'a ->
'b,
'i ->
'a Base.option ->
'b Base.option,
[< Accessor_base__.Import.isomorphism ])
Accessor.t
default x ~is_default
is an isomorphism between an option
and its contents, where None
is considered the same as default
. is_default x
is expected to be true
.
get (default _ ~is_default:_) (Some y) = y
get (default x ~is_default:_) None = x
construct (default _ ~is_default) y = if is_default y then None else Some y
Note that, as explained in the Accessor
documentation, well-behaved isomorphisms are expected to satisfy the following properties:
get (construct b) = b
construct (get at) = at
However, if is_default b = true
, both properties can be violated:
get (construct b) = get None = x
(violation if x <> b
)construct (get (Some b)) = construct b = None
include Accessor.Monad.S with type 'a t := 'a Base.option
val map :
?how:[ `Parallel | `Sequential ] ->
(Base.unit ->
'a ->
'b,
Base.unit ->
'at ->
'bt,
[> Accessor.Subtyping.many ])
Accessor.t ->
'at ->
f:('a -> 'b Base.option) ->
'bt Base.option
val mapi :
?how:[ `Parallel | `Sequential ] ->
('i -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Accessor.Subtyping.many ])
Accessor.t ->
'at ->
f:('i Accessor.Index.t -> 'a -> 'b Base.option) ->
'bt Base.option
val all :
(Base.unit ->
'a Base.option ->
'a,
Base.unit ->
'at ->
'bt,
[> Accessor.Subtyping.many ])
Accessor.t ->
'at ->
'bt Base.option
val all_unit :
(Base.unit ->
Base.unit Base.option ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
Base.unit Base.option
val iter :
?how:[ `Parallel | `Sequential ] ->
(Base.unit ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('a -> Base.unit Base.option) ->
Base.unit Base.option
val iteri :
?how:[ `Parallel | `Sequential ] ->
('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('i Accessor.Index.t -> 'a -> Base.unit Base.option) ->
Base.unit Base.option
val sum :
?how:[ `Parallel | `Sequential ] ->
(module Base.Container.Summable with type t = 'sum) ->
(Base.unit ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('a -> 'sum Base.option) ->
'sum Base.option
val sumi :
?how:[ `Parallel | `Sequential ] ->
(module Base.Container.Summable with type t = 'sum) ->
('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('i Accessor.Index.t -> 'a -> 'sum Base.option) ->
'sum Base.option
val count :
?how:[ `Parallel | `Sequential ] ->
(Base.unit ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('a -> Base.bool Base.option) ->
Base.int Base.option
val counti :
?how:[ `Parallel | `Sequential ] ->
('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
f:('i Accessor.Index.t -> 'a -> Base.bool Base.option) ->
Base.int Base.option
val map_reduce :
?how:[ `Parallel | `Sequential ] ->
(Base.unit ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
empty:'b ->
combine:('b -> 'b -> 'b) ->
f:('a -> 'b Base.option) ->
'b Base.option
val map_reducei :
?how:[ `Parallel | `Sequential ] ->
('i -> 'a -> _, Base.unit -> 'at -> _, [> Accessor.Subtyping.many_getter ])
Accessor.t ->
'at ->
empty:'b ->
combine:('b -> 'b -> 'b) ->
f:('i Accessor.Index.t -> 'a -> 'b Base.option) ->
'b Base.option
val map_reduce_nonempty :
?how:[ `Parallel | `Sequential ] ->
(Base.unit ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.nonempty_getter ])
Accessor.t ->
'at ->
combine:('b -> 'b -> 'b) ->
f:('a -> 'b Base.option) ->
'b Base.option
val map_reduce_nonemptyi :
?how:[ `Parallel | `Sequential ] ->
('i ->
'a ->
_,
Base.unit ->
'at ->
_,
[> Accessor.Subtyping.nonempty_getter ])
Accessor.t ->
'at ->
combine:('b -> 'b -> 'b) ->
f:('i Accessor.Index.t -> 'a -> 'b Base.option) ->
'b Base.option