@@ -25,6 +25,7 @@ module Control.Distributed.Process.Internal.Primitives
2525 -- * Process management
2626 , terminate
2727 , ProcessTerminationException(..)
28+ , die
2829 , kill
2930 , exit
3031 , catchExit
@@ -346,6 +347,13 @@ instance Exception ProcessTerminationException
346347terminate :: Process a
347348terminate = liftIO $ throwIO ProcessTerminationException
348349
350+-- [Issue #110]
351+-- | Die immediately - throws a 'ProcessExitException' with the given @reason@
352+die :: Serializable a => a -> Process b
353+die reason = do
354+ pid <- getSelfPid
355+ liftIO $ throwIO (ProcessExitException pid (createMessage reason))
356+
349357-- | Forceful request to kill a process
350358kill :: ProcessId -> String -> Process ()
351359-- NOTE: We send the message to our local node controller, which will then