-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Easily and clearly create lists with only one element in them. -- -- The list-singleton package allows you to easily and clearly -- create lists with only one element in them, which are typically called -- "singleton lists" or simply "singletons". (Not to be confused with the -- @singletons@ package!) -- -- With any luck this library will be included in future versions of the -- @base@ package. See this mailing list thread for an extended -- discussion: -- https://mail.haskell.org/pipermail/libraries/2019-August/029801.html. @package list-singleton @version 1.0.0.0 -- | 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
--   
module Data.List.NonEmpty.Singleton -- | 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. singleton :: a -> NonEmpty a -- | This module is meant to augment the Data.List module. You may -- want to import both modules using the same alias. For example: -- --
--   import qualified Data.List as List
--   import qualified Data.List.Singleton as List
--   
module Data.List.Singleton -- | O(1) Create a list with a single element in it. -- --
--   >>> singleton "pepperoni"
--   ["pepperoni"]
--   
-- -- There are many other ways to construct lists, so why might you prefer -- to use singleton? Here's a comparison with a few popular -- methods: -- -- -- -- The name "singleton" was chosen to mirror similar functions provided -- by other libraries. For example: -- -- -- -- Note that singleton is lazy in its argument. -- --
--   >>> length (singleton undefined)
--   1
--   
-- -- If you want to create a NonEmpty list with a single element in -- it, consider using singleton from -- Data.List.NonEmpty.Singleton. singleton :: a -> [a]