:: Ord a => [a] -> [a]

The sort function implements a stable sorting algorithm. It is a special case of sortBy, which allows the programmer to supply their own comparison function. Elements are arranged from from lowest to highest, keeping duplicates in the order they appeared in the input.
>>> sort [1,6,4,3,2,5]
[1,2,3,4,5,6]
reverse xs returns the elements of xs in reverse order. xs must be finite.
cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.
Return all the elements of a list except the last one. The list must be non-empty.
Extract the elements after the head of a list, which must be non-empty.
List of elements of a structure, from left to right.
O(n^2). The nub function removes duplicate elements from a list. In particular, it keeps only the first occurrence of each element. (The name nub means `essence'.) It is a special case of nubBy, which allows the programmer to supply their own equality test.
>>> nub [1,2,3,4,3,2,1,2,4,3,5]
[1,2,3,4,5]
Like mask, but does not pass a restore action to the argument.
Like uninterruptibleMask, but does not pass a restore action to the argument.
Repeat an action indefinitely.

Examples

A common use of forever is to process input from network sockets, Handles, and channels (e.g. MVar and Chan). For example, here is how we might implement an echo server, using forever both to listen for client connections on a network socket and to echo client input on client connection handles:
echoServer :: Socket -> IO ()
echoServer socket = forever $ do
client <- accept socket
forkFinally (echo client) (\_ -> hClose client)
where
echo :: Handle -> IO ()
echo client = forever $
hGetLine client >>= hPutStrLn client
Lift a computation from the base monad
A version of lift that can be used with just a Functor for f.
Adds an extra layer to a free monad value. In particular, for the iterative monad Iter, this makes the computation require one more step, without changing its final result.
runIter (delay ma) == Right ma
Remove a layer.
A flexible variation parameterised in a type constructor