package alg_structs
Module Alg_structs.NonEmptyListSource
Non-empty lists
The type of lists which cannot be empty.
include Functor.S with type 'a t := 'a t
include Functor.Seed with type 'a t := 'a t
map ~f maps the function f : 'a -> 'b to a function 'f T : 'a T -> 'b T.
As an example, if T (x : u) : u t then map ~(f:u -> v) (T x) is T (f x) : v t. As a result, map is often thought of as applying f "in" T.
The function map is the mapping of arrows, taking every arrow 'a -> 'b to an arrow 'a t -> 'b t.
hd t is the first element of t.
Since t is non-empty, it is guaranteed that there will always be a head.
tl t are the elements of t after, but not including the head.
Since t is non-empty, it is guaranteed that there will always be a tail.
of_list xs is a Some non-empty list of xs if xs isn't empty. Otherwise it is None.