Module Prelude.List1

Non-Empty Lists

This is a type of lists that excludes the possibility of the empty list. Thus, hd cannot raise an exception and you never need to check for the possibility of the empty list.

type 'a t = 'a * 'a list
val singleton : 'a -> 'a t
val make : int -> (int -> 'a) -> 'a t
val length : 'a t -> int
val len : 'a t -> int
val rev : 'a t -> 'a t
val cons : 'a -> 'a t -> 'a t
val append : 'a t -> 'a t -> 'a t
val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
val hd : 'a t -> 'a
val tl : 'a t -> 'a list
val last : 'a t -> 'a
val iter : ('a -> unit) -> 'a t -> unit
val map : ('a -> 'b) -> 'a t -> 'b t
val foldl : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val foldr : ('a -> 'b -> 'b) -> 'b -> 'a t -> 'b