Hoogle Search

Within LTS Haskell 24.34 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. forkIOWithUnmask :: ((forall a . () => IO a -> IO a) -> IO ()) -> IO ThreadId

    network-transport Network.Transport.Internal

    This was introduced in "base" some time after 7.0.4

  2. force :: NFData a => a -> a

    relude Relude.DeepSeq

    a variant of deepseq that is useful in some circumstances:

    force x = x `deepseq` x
    
    force x fully evaluates x, and then returns it. Note that force x only performs evaluation when the value of force x itself is demanded, so essentially it turns shallow evaluation into deep evaluation. force can be conveniently used in combination with ViewPatterns:
    {-# LANGUAGE BangPatterns, ViewPatterns #-}
    import Control.DeepSeq
    
    someFun :: ComplexData -> SomeResult
    someFun (force -> !arg) = {- 'arg' will be fully evaluated -}
    
    Another useful application is to combine force with evaluate in order to force deep evaluation relative to other IO operations:
    import Control.Exception (evaluate)
    import Control.DeepSeq
    
    main = do
    result <- evaluate $ force $ pureComputation
    {- 'result' will be fully evaluated at this point -}
    return ()
    
    Finally, here's an exception safe variant of the readFile' example:
    readFile' :: FilePath -> IO String
    readFile' fn = bracket (openFile fn ReadMode) hClose $ \h ->
    evaluate . force =<< hGetContents h
    

  3. forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)

    relude Relude.Foldable.Reexport

    forM is mapM with its arguments flipped. For a version that ignores the results see forM_.

  4. forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()

    relude Relude.Foldable.Reexport

    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.

  5. for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()

    relude Relude.Foldable.Reexport

    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
    

  6. forever :: Applicative f => f a -> f b

    relude Relude.Monad.Reexport

    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.

  7. forward :: Message -> ProcessId -> Process ()

    distributed-process Control.Distributed.Process

    Forward a raw Message to the given ProcessId.

  8. forward :: Message -> ProcessId -> Process ()

    distributed-process Control.Distributed.Process.Internal.Primitives

    Forward a raw Message to the given ProcessId.

  9. forever' :: Monad m => m a -> m b

    distributed-process Control.Distributed.Process.Internal.Types

    No documentation available.

  10. forkProcess :: LocalNode -> Process () -> IO ProcessId

    distributed-process Control.Distributed.Process.Node

    Spawn a new process on a local node

Page 48 of many | Previous | Next