A small library to create threads that never die. This is useful e.g. for
writing servers.
import qualified Control.Immortal as Immortal
import Control.Concurrent (threadDelay)
import Control.Monad (forever)
main = do
-- start an immortal thread
_thread <- Immortal.create $ \ _thread -> do
-- do stuff
-- in the main thread, sleep until interrupted
-- (e.g. with Ctrl-C)
forever $ threadDelay maxBound
Changes
CHANGES
Version 0.3
Replace monad-control with unliftio-core.
As a result, immortal will no longer work with stateful monads like StateT,
which is considered a feature.