The Haskell-1.2 I/O request `SigAction n act' installs a signal handler for signal
`n :: Int'. The number is the usual UNIX signal number. The action
is of this type:
data SigAct
= SAIgnore
| SADefault
| SACatch Dialogue
The corresponding continuation-style I/O function is the unsurprising:
sigAction :: Int -> SigAct -> FailCont -> SuccCont -> Dialogue
When a signal handler is installed with `SACatch', receipt of the
signal causes the current top-level computation to be abandoned, and
the specified dialogue to be executed instead. The abandoned
computation may leave some partially evaluated expressions in a
non-resumable state. If you believe that your top-level computation
and your signal handling dialogue may share subexpressions, you should
execute your program with the `-N' RTS option, to prevent
black-holing.
The `-N' option is not available with concurrent/parallel programs,
so great care should be taken to avoid shared subexpressions between
the top-level computation and any signal handlers when using threads.