No title

Anonymous Coward 2018-03-07 15:25:15.258183 UTC

1multishot :: FilePath -> [FilePath] -> ReportM ((FilePath -> ReportM ()) -> ReportM Continue)
2multishot initFile restartPaths = liftIO $ do
3 initTimes <- mapM getModTime restartPaths
4 return $ \report -> do
5 newFile <- doUntil (\newTimes -> initTimes /= newTimes) report $ \fp -> do
6 report fp
7 newFile <- liftIO getLine
8 newTimes <- liftIO $ mapM getModTime restartPaths
9 return (newTimes, newFile)
10 return (Restart newFile)
11
12doUntil :: Monad m => (b -> Bool) -> a -> (a -> m (b, a)) -> m a