Hoogle Search

Within LTS Haskell 24.32 (ghc-9.10.3)

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

  1. readTVarIO :: TVar a -> IO a

    stm Control.Concurrent.STM.TVar

    No documentation available.

  2. readCreateProcess :: CreateProcess -> String -> IO String

    process System.Process

    readCreateProcess works exactly like readProcess except that it lets you pass CreateProcess giving better flexibility.

    > readCreateProcess ((shell "pwd") { cwd = Just "/etc/" }) ""
    "/etc\n"
    
    Note that Handles provided for std_in or std_out via the CreateProcess record will be ignored.

  3. readCreateProcessWithExitCode :: CreateProcess -> String -> IO (ExitCode, String, String)

    process System.Process

    readCreateProcessWithExitCode works exactly like readProcessWithExitCode except that it lets you pass CreateProcess giving better flexibility. Note that Handles provided for std_in, std_out, or std_err via the CreateProcess record will be ignored.

  4. readProcess :: FilePath -> [String] -> String -> IO String

    process System.Process

    readProcess forks an external process, reads its standard output strictly, blocking until the process terminates, and returns the output string. The external process inherits the standard error. If an asynchronous exception is thrown to the thread executing readProcess, the forked process will be terminated and readProcess will wait (block) until the process has been terminated. Output is returned strictly, so this is not suitable for launching processes that require interaction over the standard file streams. This function throws an IOError if the process ExitCode is anything other than ExitSuccess. If instead you want to get the ExitCode then use readProcessWithExitCode. Users of this function should compile with -threaded if they want other Haskell threads to keep running while waiting on the result of readProcess.

    > readProcess "date" [] []
    "Thu Feb  7 10:03:39 PST 2008\n"
    
    The arguments are:
    • The command to run, which must be in the $PATH, or an absolute or relative path
    • A list of separate command line arguments to the program. See RawCommand for further discussion of Windows semantics.
    • A string to pass on standard input to the forked process.

  5. readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String)

    process System.Process

    readProcessWithExitCode is like readProcess but with two differences:

    • it returns the ExitCode of the process, and does not throw any exception if the code is not ExitSuccess.
    • it reads and returns the output from process' standard error handle, rather than the process inheriting the standard error handle.
    On Unix systems, see waitForProcess for the meaning of exit codes when the process died as the result of a signal.

  6. readCreateProcessWithExitCodeCommunicationHandle :: NFData a => ((CommunicationHandle, CommunicationHandle) -> CreateProcess) -> (Handle -> IO a) -> (Handle -> IO ()) -> IO (ExitCode, a)

    process System.Process.CommunicationHandle

    A version of readCreateProcessWithExitCode that communicates with the child process through a pair of CommunicationHandles. Example usage:

    readCreateProcessWithExitCodeCommunicationHandle
    (\(chTheyRead, chTheyWrite) -> proc "child-exe" [show chTheyRead, show chTheyWrite])
    (\ hWeRead -> hGetContents hWeRead)
    (\ hWeWrite -> hPut hWeWrite "xyz")
    
    where child-exe is a separate executable that is implemented as:
    main = do
    [chRead, chWrite] <- getArgs
    hRead  <- openCommunicationHandleRead  $ read chRead
    hWrite <- openCommunicationHandleWrite $ read chWrite
    input <- hGetContents hRead
    hPut hWrite $ someFn input
    hClose hWrite
    

  7. readArray :: PrimMonad m => MutableArray (PrimState m) a -> Int -> m a

    primitive Data.Primitive.Array

    Read a value from the array at the given index. Note: this function does not do bounds checking.

  8. readByteArray :: (Prim a, PrimMonad m) => MutableByteArray (PrimState m) -> Int -> m a

    primitive Data.Primitive.ByteArray

    Read a primitive value from the byte array. The offset is given in elements of type a rather than in bytes. Note: this function does not do bounds checking.

  9. readCharArray :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> m Char

    primitive Data.Primitive.ByteArray

    Read an 8-bit element from the byte array, interpreting it as a Latin-1-encoded character. The offset is given in bytes. Note: this function does not do bounds checking.

  10. readMVar :: PrimMonad m => MVar (PrimState m) a -> m a

    primitive Data.Primitive.MVar

    Atomically read the contents of an MVar. If the MVar is currently empty, readMVar will wait until it is full. readMVar is guaranteed to receive the next putMVar. Multiple Wakeup: readMVar is multiple-wakeup, so when multiple readers are blocked on an MVar, all of them are woken up at the same time.

    • It is single-wakeup instead of multiple-wakeup.
    • It might not receive the value from the next call to putMVar if there is already a pending thread blocked on takeMVar.
    • If another thread puts a value in the MVar in between the calls to takeMVar and putMVar, that value may be overridden.

Page 73 of many | Previous | Next