# Pastebin CnZCMWic doesThisHalt :: IO a -> Bool doesThisHalt = doesHalt . run run :: IO a -> IO (Maybe a) run m = do r <- newIORef Nothing m `catch` (\e -> writeIORef r (Just e)) readIORef r doesHalt :: IO (Maybe a) -> Bool doesHalt m = case m of Nothing -> False Just e -> True