Jak napisać program obsługi Ctrl-C w Haskell?
Próbowałem następującego podejścia:
import System.Exit
import System.Posix.Signals
import Control.Concurrent (threadDelay)
main :: IO ()
main = do
installHandler keyboardSignal (Catch (do exitSuccess)) Nothing
threadDelay (1000000000)
Ale generuje tylko:
^CTest.hs: ExitSuccess
naCtrl-C
, zamiast wychodzić. Jak mam to zrobić prawidłowo?