Allows restarting the currently running Haskell executable
Haskell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
System
.gitignore
.travis.yml
README.md
Test.hs
selfrestart
selfrestart.cabal

README.md

selfrestart

Build Status

Allows restarting the currently running Haskell executable.

Uses exec().

Example

module Main (main) where

import Control.Concurrent
import Control.Monad

import System.SelfRestart (selfRestart, forkSelfRestartExePollWithAction)

main :: IO ()
main = do

  -- Spawn thread to restart when executable changes
  forkSelfRestartExePollWithAction 1.0 $
    putStrLn "executable changed, restarting"

  forM_ [1..4] $ \x -> do
    print x
    threadDelay 1000000

  -- Restart when the loop is over
  putStrLn "counter done, selfRestart"
  selfRestart