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

[ bsd3, library, system, testing ] [ Propose Tags ]

Prevent or capture writing to stdout, stderr, and other handles.

[Skip to Readme]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2,,, 1.2.3, 1.2.4,, 1.2.5,,,
Change log
Dependencies base (>=4.3 && <5), deepseq, directory [details]
License BSD-3-Clause
Copyright (c) Trystan Spangler 2011
Author Trystan Spangler
Maintainer Sönke Hahn <>, Simon Hengel <>, Andreas Abel
Category System, Testing
Home page
Bug tracker
Source repo head: git clone
Uploaded by AndreasAbel at 2022-08-21T17:20:10Z
Distributions Arch:, Debian:, Fedora:, FreeBSD:1.2.5, LTSHaskell:, NixOS:, Stackage:, openSUSE:
Reverse Dependencies 13 direct, 628 indirect [details]
Downloads 89509 total (188 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-08-21 [all 1 reports]

Readme for silently-

[back to package description]

Hackage version silently on Stackage Nightly Stackage LTS version Cabal build


Silently is a package that allows you to run an IO action and prevent it from writing to stdout, or any other handle, by using silence. Or you can capture the output for yourself using capture.

For example, the program

 import System.IO.Silently

 main = do
   putStr "putStrLn: " >> putStrLn "puppies!"
   putStr "silenced: " >> silence (putStrLn "kittens!")
   putStrLn ""
   (captured, result) <- capture (putStr "wookies!" >> return 123)
   putStr "captured: " >> putStrLn captured
   putStr "returned: " >> putStrLn (show result)

will print:

 putStrLn: puppies!
 captured: wookies!
 returned: 123


Capturing/silencing might not work as expected if the action uses the FFI or conceals output under unsafePerformIO or similar unsafe operations.