list-singleton-1.0.0.2: Easily and clearly create lists with only one element in them.

Data.List.NonEmpty.Singleton

Description

This module is meant to augment the Data.List.NonEmpty module. You may want to import both modules using the same alias. For example:

import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.List.NonEmpty.Singleton as NonEmpty

Synopsis

Documentation

singleton :: a -> NonEmpty a Source #

O(1) Create a non-empty list with a single element in it.

>>> singleton "pepperoni"
"pepperoni" :| []


If you want to create a regular list with a single element in it, consider using singleton from Data.List.Singleton.

Since: 1.0.0.0