Commit 375b3c45 authored by Oleg Grenrus's avatar Oleg Grenrus Committed by Marge Bot

Add singleton to Data.OldList

parent 5670881d
Pipeline #15645 passed with stages
in 402 minutes and 37 seconds
......@@ -26,6 +26,7 @@ module Data.OldList
, tail
, init
, uncons
, singleton
, null
, length
......@@ -1269,6 +1270,16 @@ sortOn :: Ord b => (a -> b) -> [a] -> [a]
sortOn f =
map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x))
-- | Produce singleton list.
--
-- >>> singleton True
-- [True]
--
-- @since 4.14.0.0
--
singleton :: a -> [a]
singleton x = [x]
-- | The 'unfoldr' function is a \`dual\' to 'foldr': while 'foldr'
-- reduces a list to a summary value, 'unfoldr' builds a list from
-- a seed value. The function takes the element and returns 'Nothing'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment