package travesty

  1. Overview
  2. Docs
Traversable containers, monad extensions, and more

Install

Dune Dependency

Authors

Maintainers

Sources

travesty-v0.7.0.tbz
sha256=01661918f73f33b0e6d0cf3851c2d5d6ef76b86332a3e76a4958689ff1a6fd3a
sha512=14e9b0e9ae39055c386c5e996055ce59edf57b9bf9b0055722632520f9c9b0270af571576950be982ed2b86e859361c7344166a38a85fa7d28d45be8f3e18c77

doc/travesty.containers/Travesty_containers/Zipper/Int_mark_zipper/On_monad/index.html

Module Int_mark_zipper.On_monadSource

On_monad provides various marked zipper operations parametrised by a monad.

Parameters

module M : Base.Monad.S

Signature

include Zipper_types.S_monadic with type 'a t := 'a t with module M := M
Sourceval pop_m : 'a t -> on_empty:('a t -> ('a * 'a t) M.t) -> ('a * 'a t) M.t

pop_m zipper ~on_empty behaves like pop, but executes a custom monadic action on_empty, instead of returning an error, when the cursor is empty.

Sourceval peek_m : ?steps:Base.int -> 'a t -> on_empty:('a t -> 'a M.t) -> 'a M.t

peek_m ?steps zipper ~on_empty behaves like peek_opt, but executes a custom monadic action on_empty, instead of returning None, when the cursor is empty.

Sourceval step_m : ?steps:Base.int -> 'a t -> on_empty:('a t -> 'a t M.t) -> 'a t M.t

step_m ?steps zipper ~on_empty behaves like step, but executes a custom monadic action on_empty, instead of returning an error, when the cursor is empty.

Sourceval map_m_head : 'a t -> f:('a -> 'a Base.option M.t) -> on_empty:('a t -> 'a t M.t) -> 'a t M.t

map_m_head ?steps zipper ~on_empty behaves like map_head, but executes a custom monadic action on_empty, instead of leaving the zipper unchanged, when the cursor is empty.

Sourceval mark_m : 'a t -> mark:Base.int -> on_empty:('a t -> 'a t M.t) -> 'a t M.t

mark_m zipper ~mark ~on_empty behaves like mark, but executes a custom monadic action on_empty, instead of returning an error, when the cursor is empty.

Sourceval recall_m : 'a t -> mark:Base.int -> on_empty:('a t -> 'a t M.t) -> 'a t M.t

recall_m zipper ~mark ~on_empty behaves like recall, but executes a custom monadic action on_empty, instead of returning an error, when the mark can't be found.

Sourceval delete_to_mark_m : 'a t -> mark:Base.int -> on_empty:('a t -> 'a t M.t) -> 'a t M.t

delete_to_mark_m zipper ~mark ~on_empty behaves like delete_to_mark, but executes a custom monadic action on_empty, instead of returning an error, when the mark can't be found.

Sourceval fold_m_until : 'a t -> f: ('acc -> 'a -> 'a t -> (Base.int, 'a, 'acc, 'final) Zipper_types.fold_outcome M.t) -> init:'acc -> finish:('acc -> 'a t -> 'final M.t) -> 'final M.t

fold_m_until zipper ~f ~init ~finish behaves like fold_until, except that f and finish, and therefore the function itself, return results inside a monad context.

OCaml

Innovation. Community. Security.