:: a -> [a] package:base

repeat x is an infinite list, with x the value of every element.

Examples

>>> take 10 $ repeat 17
[17,17,17,17,17,17,17,17,17, 17]
>>> repeat undefined
[*** Exception: Prelude.undefined
Construct a list from a single element.

Examples

>>> singleton True
[True]
>>> singleton [1, 2, 3]
[[1,2,3]]
>>> singleton 'c'
"c"
Lift a value into the Structure.

Examples

>>> pure 1 :: Maybe Int
Just 1
>>> pure 'z' :: [Char]
"z"
>>> pure (pure ":D") :: Maybe [String]
Just [":D"]