:: a -> [a] package:ghc-internal

Construct a list from a single element.

Examples

>>> singleton True
[True]
>>> singleton [1, 2, 3]
[[1,2,3]]
>>> singleton 'c'
"c"
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