Hoogle Search

Within LTS Haskell 24.40 (ghc-9.10.3)

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

  1. hWaitForInput :: Handle -> Int -> IO Bool

    ghc-internal GHC.Internal.IO.Handle

    Computation hWaitForInput hdl t waits until input is available on handle hdl. It returns True as soon as input is available on hdl, or False if no input is available within t milliseconds. Note that hWaitForInput waits until one or more full characters are available, which means that it needs to do decoding, and hence may fail with a decoding error. If t is less than zero, then hWaitForInput waits indefinitely. This operation may fail with:

    • isEOFError if the end of file has been reached.
    • a decoding error, if the input begins with an invalid byte sequence in this Handle's encoding.
    NOTE for GHC users: unless you use the -threaded flag, hWaitForInput hdl t where t >= 0 will block all other Haskell threads for the duration of the call. It behaves like a safe foreign call in this respect.

  2. hWaitForInput :: Handle -> Int -> IO Bool

    ghc-internal GHC.Internal.IO.Handle.Text

    Computation hWaitForInput hdl t waits until input is available on handle hdl. It returns True as soon as input is available on hdl, or False if no input is available within t milliseconds. Note that hWaitForInput waits until one or more full characters are available, which means that it needs to do decoding, and hence may fail with a decoding error. If t is less than zero, then hWaitForInput waits indefinitely. This operation may fail with:

    • isEOFError if the end of file has been reached.
    • a decoding error, if the input begins with an invalid byte sequence in this Handle's encoding.
    NOTE for GHC users: unless you use the -threaded flag, hWaitForInput hdl t where t >= 0 will block all other Haskell threads for the duration of the call. It behaves like a safe foreign call in this respect.

  3. unsafeDupablePerformIO :: IO a -> a

    ghc-internal GHC.Internal.IO.Unsafe

    This version of unsafePerformIO is more efficient because it omits the check that the IO is only being performed by a single thread. Hence, when you use unsafeDupablePerformIO, there is a possibility that the IO action may be performed multiple times (on a multiprocessor), and you should therefore ensure that it gives the same results each time. It may even happen that one of the duplicated IO actions is only run partially, and then interrupted in the middle without an exception being raised. Therefore, functions like bracket cannot be used safely within unsafeDupablePerformIO.

  4. unsafePerformIO :: IO a -> a

    ghc-internal GHC.Internal.IO.Unsafe

    This is the "back door" into the IO monad, allowing IO computation to be performed at any time. For this to be safe, the IO computation should be free of side effects and independent of its environment. If the I/O computation wrapped in unsafePerformIO performs side effects, then the relative order in which those side effects take place (relative to the main I/O trunk, or other calls to unsafePerformIO) is indeterminate. Furthermore, when using unsafePerformIO to cause side-effects, you should take the following precautions to ensure the side effects are performed as many times as you expect them to be. Note that these precautions are necessary for GHC, but may not be sufficient, and other compilers may require different precautions:

    • Use {-# NOINLINE foo #-} as a pragma on any function foo that calls unsafePerformIO. If the call is inlined, the I/O may be performed more than once.
    • Use the compiler flag -fno-cse to prevent common sub-expression elimination being performed on the module, which might combine two side effects that were meant to be separate. A good example is using multiple global variables (like test in the example below).
    • Make sure that the either you switch off let-floating (-fno-full-laziness), or that the call to unsafePerformIO cannot float outside a lambda. For example, if you say: f x = unsafePerformIO (newIORef []) you may get only one reference cell shared between all calls to f. Better would be f x = unsafePerformIO (newIORef [x]) because now it can't float outside the lambda.
    It is less well known that unsafePerformIO is not type safe. For example:
    test :: IORef [a]
    test = unsafePerformIO $ newIORef []
    
    main = do
    writeIORef test [42]
    bang <- readIORef test
    print (bang :: [Char])
    
    This program will core dump. This problem with polymorphic references is well known in the ML community, and does not arise with normal monadic use of references. There is no easy way to make it impossible once you use unsafePerformIO. Indeed, it is possible to write coerce :: a -> b with the help of unsafePerformIO. So be careful! WARNING: If you're looking for "a way to get a String from an 'IO String'", then unsafePerformIO is not the way to go. Learn about do-notation and the <- syntax element before you proceed.

  5. hWaitForInput :: Handle -> Int -> IO Bool

    ghc-internal GHC.Internal.System.IO

    Computation hWaitForInput hdl t waits until input is available on handle hdl. It returns True as soon as input is available on hdl, or False if no input is available within t milliseconds. Note that hWaitForInput waits until one or more full characters are available, which means that it needs to do decoding, and hence may fail with a decoding error. If t is less than zero, then hWaitForInput waits indefinitely. This operation may fail with:

    • isEOFError if the end of file has been reached.
    • a decoding error, if the input begins with an invalid byte sequence in this Handle's encoding.
    NOTE for GHC users: unless you use the -threaded flag, hWaitForInput hdl t where t >= 0 will block all other Haskell threads for the duration of the call. It behaves like a safe foreign call in this respect.

  6. performBlockingMajorGC :: IO ()

    ghc-internal GHC.Internal.System.Mem

    Triggers an immediate major garbage collection, ensuring that collection finishes before returning.

  7. performGC :: IO ()

    ghc-internal GHC.Internal.System.Mem

    Triggers an immediate major garbage collection.

  8. performMajorGC :: IO ()

    ghc-internal GHC.Internal.System.Mem

    Triggers an immediate major garbage collection.

  9. performMinorGC :: IO ()

    ghc-internal GHC.Internal.System.Mem

    Triggers an immediate minor garbage collection.

  10. c_fork :: IO CPid

    ghc-internal GHC.Internal.System.Posix.Internals

    No documentation available.

Page 626 of many | Previous | Next