package plebeia

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Cursor.MonadSource

Same as cursor, but in Monadic interface. Experimental.

The position of the cursor never changes if the result is an Error.

include Monad.S1 with type 'a t = Cursor.cursor -> Cursor.cursor * ('a, Error.t) Result.t
Sourceval return : 'a -> 'a t
Sourceval bind : 'a t -> ('a -> 'b t) -> 'b t
Sourceval map : ('a -> 'b) -> 'a t -> 'b t
Sourceval mapM : ('a -> 'b t) -> 'a list -> 'b list t
Sourceval mapM_ : ('a -> unit t) -> 'a list -> unit t
Sourceval iterM : ('a -> unit t) -> 'a list -> unit t

alias of mapM_

Sourceval fold_leftM : ('a -> 'b -> 'a t) -> 'a -> 'b list -> 'a t
Sourceval parseM : ('a -> 'b list -> ('a * 'b list) t) -> 'a -> 'b list -> 'a t
Sourcemodule Infix : sig ... end
Sourcemodule Syntax : sig ... end
Sourceval path : Path.t t

Returns the absolute position of the cursor.

Sourceval local_segment : Segment.t t

Returns the relative position of the cursor from the nearest Bud above.

Returns the view of the node pointed by the cursor.

Sourceval index : Index.t option t

Return the index of the node pointed by the cursor, if available.

Sourceval go_below_bud : unit t

Move the cursor below the Bud pointed by it.

The function fails and the cursor does not move if: * The cursor does not point to a Bud or if the pointed Bud is empty.

Sourceval go_side : Segment.side -> unit t

Move the cursor Left or Right below the Internal pointed by it.

The function fails and the cursor does not move if: * The cursor does not point to an Internal.

Sourceval go_down_extender : unit t

Move the cursor below the Extender pointed by it.

The function fails and the cursor does not move if: * The cursor does not point to an Extender.

Sourceval go_up : unit t

Move up the cursor.

The function fails and the cursor does not move if: * The cursor points to the top Bud.

Sourceval go_top : unit t

Move the cursor to the top Bud.

Sourceval go_up_to_bud : unit t

Move the cursor up to the nearest Bud above.

The function fails and the cursor does not move if: * The cursor points to the top Bud.

Sourceval subtree : Segment.t -> unit t

Move the cursor pointing at a Bud to a sub-Bud specified by the segment.

The function fails and the cursor does not move if: * The cursor does not point to a Bud. * The sub-Bud does not exist.

Sourceval get : Segment.t -> [ `Leaf of Node_type.view | `Bud of Node_type.view ] t

Get the Leaf or Bud of the node pointed by the cursor.

The function fails if: * The cursor does not point to a Bud. * The speficied node does not exist nor is not a Bud nor a Leaf.

Sourceval get_value : Segment.t -> Value.t t

Get the value of the Leaf pointed by the cursor.

The function fails if: * The cursor does not point to a Bud. * The speficied node does not exist nor is not a Leaf.

Sourceval delete : Segment.t -> unit t

Delete the node at the segment from the cursor.

The function fails if: * The cursor does not point to a Bud. * The speficied node does not exist.

Sourceval alter : Segment.t -> (Node_type.view option -> (Node_type.node, Error.t) Result.t) -> unit t

Alter the node at the segment from the Bud pointed by the cursor.

The alteration function takes the view of the node or None if it does not exist. The function returns a new node to replace the original (or be inserted if the target does not exist) or an error.

The function fails if: * The cursor does not point to a Bud. * The segment is blocked by a Bud or an Extender. * The alteration function returns an Error.

Sourceval insert : Segment.t -> Value.t -> unit t

Insert a Leaf of the specified value at the segment from the Bud pointed by the cursor.

The function fails if: * The cursor does not point to a Bud. * The segment is blocked by a Bud or an Extender. * The specified node already exists.

Sourceval update : Segment.t -> Value.t -> unit t

Update the value of the Leaf specified by the segment from the Bud pointed by the cursor. The Leaf must exist.

The function fails if: * The cursor does not point to a Bud. * The specified node is not a Leaf, or does not exist.

Sourceval upsert : Segment.t -> Value.t -> unit t

Upsert the value of the Leaf specified by the segment from the Bud pointed by the cursor. The Leaf may or may not exist.

The function fails if: * The cursor does not point to a Bud. * The segment is blocked by a Bud or an Extender. * The specified node already exists and it is not a Leaf.

Sourceval create_subtree : Segment.t -> unit t

Create a sub Bud at the segment from the Bud pointed by the cursor.

The function fails if: * The cursor does not point to a Bud. * The segment is blocked by a Bud or an Extender. * The specified node already exists.

Sourceval subtree_or_create : Segment.t -> unit t

Move the cursor down to a sub Bud specified by the segment. If the sub Bud does not exist, it creates before moving down the cursor.

The function fails if: * The cursor does not point to a Bud. * The segment is blocked by a Bud or an Extender. * The specified node already exists and it is not a Bud.

Sourceval stat : Stat.t t

Returns the statistics of the context

Sourceval may_forget : unit t

Forget the contents of the node (and its sub-nodes) pointed by the cursor, if they are already stored in the storage.

If the contents are not yet stored in the storage, it does nothing.

OCaml

Innovation. Community. Security.