singleton
lib.singleton
Docs pulled from | This Revision | about 1 hour ago
Create a list consisting of a single element. singleton x
is
sometimes more convenient with respect to indentation than [x]
when x spans multiple lines.
Inputs
x
-
1. Function argument
Type
singleton :: a -> [a]
Examples
lib.lists.singleton
usage example
singleton "foo"
=> [ "foo" ]
Noogle detected
Implementation
The following is the current implementation of this function.
singleton = x: [x];