Module NesNEList

Non-empty list

type 'a t

A non-empty list.

val equal : ('a -> 'a -> Ppx_deriving_runtime.bool) -> 'a t -> 'a t -> Ppx_deriving_runtime.bool
val compare : ('a -> 'a -> Ppx_deriving_runtime.int) -> 'a t -> 'a t -> Ppx_deriving_runtime.int
val pp : (Ppx_deriving_runtime.Format.formatter -> 'a -> Ppx_deriving_runtime.unit) -> Ppx_deriving_runtime.Format.formatter -> 'a t -> Ppx_deriving_runtime.unit
val show : (Ppx_deriving_runtime.Format.formatter -> 'a -> Ppx_deriving_runtime.unit) -> 'a t -> Ppx_deriving_runtime.string
val to_yojson : ('a -> Yojson.Safe.t) -> 'a t -> Yojson.Safe.t
val of_yojson : (Yojson.Safe.t -> 'a Ppx_deriving_yojson_runtime.error_or) -> Yojson.Safe.t -> 'a t Ppx_deriving_yojson_runtime.error_or
val to_list : 'a t -> 'a list

Convert a non-empty list to a regular list.

val of_list : 'a list -> 'a t option

Convert a list to a non-empty list.

val of_list_exn : 'a list -> 'a t

Convert a list to a non-empty string, or raise Invalid_argument if the list is empty.

val hd : 'a t -> 'a

Get the head of a non-empty list, that is the first element of the list.

val tl : 'a t -> 'a list

Get the tail of a non-empty list, that is the list without its first element.

val map : ('a -> 'b) -> 'a t -> 'b t

Map a function over a non-empty list.

val map_lwt_p : ('a -> 'b Lwt.t) -> 'a t -> 'b t Lwt.t

Similar to Lwt_list.map_p for non-empty lists.

val singleton : 'a -> 'a t

Create a non-empty list with a single element.

val is_singleton : 'a t -> bool

Check if the non-empty list contains a single element.

val mem : 'a -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool