# a -> [b]

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 if it is done producing the list or returns Just (a,b), in which case, a is a prepended to the list and b is used as the next element in a recursive call. For example, > iterate f == unfoldr (\x -> Just (x, f x)) In some cases, unfoldr can undo a foldr operation: > unfoldr f' (foldr f z xs) == xs if the following holds: > f' (f x y) = Just (x,y) > f' z = Nothing A simple use of unfoldr: > unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10 > [10,9,8,7,6,5,4,3,2,1]
repeat x is an infinite list, with x the value of every element.
Returns no shrinking alternatives.
iterate f x returns an infinite list of repeated applications of f to x: > iterate f x == [x, f x, f (f x), ...]
The genericReplicate function is an overloaded version of replicate, which accepts any Integral value as the number of repetitions to make.
The intersperse function takes an element and a list and `intersperses' that element between the elements of the list. For example, > intersperse ',' "abcde" == "a,b,c,d,e"
replicate n x is a list of length n with x the value of every element. It is an instance of the more general Data.List.genericReplicate, in which n may be of any integral type.
The genericDrop function is an overloaded version of drop, which accepts any Integral value as the number of elements to drop.
The genericTake function is an overloaded version of take, which accepts any Integral value as the number of elements to take.
The underlying computation, as a function of the environment.
The underlying computation, as a function of the environment.
map f xs is the list obtained by applying f to each element of xs, i.e., > map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] > map f [x1, x2, ...] == [f x1, f x2, ...]
Map a function over a list and concatenate the results.
The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it just Just b, then b is included in the result list.
Map a function over all the elements of a container and concatenate the resulting lists.