NonEmpty-0.1: Library providing a non-empty list datatype, and total functions operating on it

Data.List.NonEmpty

Synopsis

Documentation

listToNonEmpty :: Monad m => [a] -> m (NonEmpty a)Source

Tries to convert a list to a NonEmpty. Returns the NonEmpty if it can, or fails in the monad otherwise.

data NonEmpty a Source

A non-empty list

Constructors

NonEmpty 

Fields

neHead :: a
 
neTail :: [a]
 

nonEmptyToList :: NonEmpty a -> [a]Source

Semantic function for NonEmpty

length' :: NonEmpty a -> IntSource

Length of a given NonEmpty