silently-1.2.5: Prevent or capture writing to stdout and other handles.

Safe Haskell | Safe
Language | Haskell98

System.IO.Silently

Description

Need to prevent output to the terminal, a file, or stderr? Need to capture it and use it for your own means? Now you can, with `silence` and `capture`.

Synopsis

- silence :: IO a -> IO a
- hSilence :: [Handle] -> IO a -> IO a
- capture :: IO a -> IO (String, a)
- capture_ :: IO a -> IO String
- hCapture :: [Handle] -> IO a -> IO (String, a)
- hCapture_ :: [Handle] -> IO a -> IO String

# Documentation

silence :: IO a -> IO a #

Run an IO action while preventing all output to stdout.

hSilence :: [Handle] -> IO a -> IO a #

Run an IO action while preventing all output to the given handles.

capture :: IO a -> IO (String, a) #

Run an IO action while preventing and capturing all output to stdout. This will, as a side effect, create and delete a temp file in the temp directory or current directory if there is no temp directory.

capture_ :: IO a -> IO String #

Like `capture`, but discards the result of given action.

hCapture :: [Handle] -> IO a -> IO (String, a) #

Run an IO action while preventing and capturing all output to the given handles. This will, as a side effect, create and delete a temp file in the temp directory or current directory if there is no temp directory.

hCapture_ :: [Handle] -> IO a -> IO String #

Like `hCapture`, but discards the result of given action.