for package:faktory

for is traverse with its arguments flipped. For a version that ignores the results see for_.
forAccumM is mapAccumM with the arguments rearranged.
forM is mapM with its arguments flipped. For a version that ignores the results see forM_.
forM_ is mapM_ with its arguments flipped. For a version that doesn't ignore the results see forM. forM_ is just like for_, but specialised to monadic actions.
for_ is traverse_ with its arguments flipped. For a version that doesn't ignore the results see for. This is forM_ generalised to Applicative actions. for_ is just like forM_, but generalised to Applicative actions.

Examples

Basic usage:
>>> for_ [1..4] print
1
2
3
4
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.
Deprecated: Use ‘perform (options <> tracked)’ instead
Perform a Job with the given options
perform mempty SomeJob
perform (queue SomeQueue) SomeJob
perform once SomeJob
perform (at someTime <> once) SomeJob
perform (in_ 10 <> once) SomeJob
perform (in_ 10 <> retry 3) SomeJob
perform but using a Producer from the pool
Wait for input to become available on a connection. As with hWaitForInput, the timeout value is given in milliseconds. If the timeout value is less than zero, then connectionWaitForInput waits indefinitely. Unlike hWaitForInput, this function does not do any decoding, so it returns true when there is any available input, not just full characters.