This type could be
data NonEmptyList a = NEL a [a]
The functions head
, tail
, and others will become methods of a newly created Listable
type class. Some functions can already fit in an existing type class (maps/folds/traversals/monads).
Why is such a type not part of the Haskell standard library?
semigroups
package. – Oina