title: How to write Ctrl-C handler in Haskell?
body: <p>I tried the following approach:</p>
  
  <pre><code>import System.Exit
  import System.Posix.Signals
  import Control.Concurrent (threadDelay)
  
  main :: IO ()
  main = do
    installHandler keyboardSignal (Catch (do exitSuccess)) Nothing
    threadDelay (1000000000)
  </code></pre>
  
  <p>But it only outputs:</p>
  
  <pre><code>^CTest.hs: ExitSuccess
  </code></pre>
  
  <p>on <code>Ctrl-C</code>, instead of exiting. How should I do it properly?</p>