:: List a -> List a -package:strict-list

Remove the last element from a list if there is one, otherwise return Nil.
Reverse a list.
Generalized version of runInBoundThread.
Generalized version of runInUnboundThread.
Generalized version of mask_.
Generalized version of uninterruptibleMask_.
Use subAssert if you want location information for the call site but the function being called does not carry a HasCallStack constraint.
Cull nondeterminism in the argument, returning at most one result.
cull (pure a <|> m) <|> n = pure a <|> n
Delimit the effect of cutfails, allowing backtracking to resume.
call cutfail <|> m = m
Syntax sugar for case_.
Going under a binder.
Annotate credentials with no scope authorization.
Wrap a MonadIO computation so that it prints out the execution time.
This function, or withStderrLogging, must be wrapped around whatever region of your application intends to use logging. Typically it would be wrapped around the body of main.
O(n) Yield the argument but force it not to retain any extra memory, possibly by copying it. This is especially useful when dealing with slices. For example:
force (slice 0 2 <huge vector>)
Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.
O(n) Reverse a vector
O(1) Yield all but the last element without copying. The vector may not be empty.
O(1) Yield all but the first element without copying. The vector may not be empty.
O(1) Yield all but the last element without copying. The vector may not be empty but this is not checked.
O(1) Yield all but the first element without copying. The vector may not be empty but this is not checked.
Reverse order of elements in the vector
Coerce while preserving the type index.
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
Note that "forever" isn't necessarily non-terminating. If the action is in a MonadPlus and short-circuits after some number of iterations. then forever actually returns mzero, effectively short-circuiting its caller.
Repeat an action indefinitely. Using ApplicativeDo: 'forever as' can be understood as the pseudo-do expression
do as
as
..
with as repeating.

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