package links

  1. Overview
  2. Docs
type 'a t = private {
  1. node : 'a;
  2. pos : Position.t;
}
val make : ?pos:Position.t -> 'a -> 'a t

Construct a new with_pos given a node and an optional source code position. Use the dummy position if none is specified.

val dummy : 'a -> 'a t

Construct a new with_pos with a dummy source position

val node : 'a t -> 'a

Fetch the corresponding node.

val pos : 'a t -> Position.t

Fetch the corresponding source code position.

val map : 'a t -> f:('a -> 'b) -> 'b t
val map2 : 'a t -> f_pos:(Position.t -> Position.t) -> f_node:('a -> 'b) -> 'b t
val with_node : 'a t -> 'b -> 'b t
val nodes_of_list : 'a t list -> 'a list

Discard positions from elements in a list *

val traverse : 'a t -> o:'o -> f_pos:('o -> Position.t -> 'b) -> f_node:('b -> 'a -> 'c) -> 'c
val traverse_map : 'a t -> o:'o -> f_pos:('o -> Position.t -> 'b * Position.t) -> f_node:('b -> 'a -> 'c * 'd) -> 'c * 'd t
OCaml

Innovation. Community. Security.