Signal

Signal :: # (opaque)

Cooperatively handle requests to stop the process.

Register before acquiring resources that need application cleanup. A caught event makes blocking effects return Interrupted; acknowledge it with [poll!] before running application cleanup. Catching does not clean up remote resources automatically.

catch! : List(Request) => Try({}, [SignalErr(IOErr)])

Add events to those caught for the lifetime of this process. Interrupt catches Ctrl-C. Terminate(unix) catches Unix SIGTERM, including systemd's default stop request. Duplicate registrations and an empty list do nothing. Repeated events coalesce and never force exit.

poll! : () => List(Kind)

Acknowledge pending events, returning each kind at most once, in Interrupt/Terminate order. An interrupted effect does not acknowledge events itself. Native forced termination cannot be caught.

Kind : [Interrupt, Terminate]
Request : [Interrupt, Terminate(Unix)]