Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Last active December 30, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakubOboza/7804859 to your computer and use it in GitHub Desktop.
Save JakubOboza/7804859 to your computer and use it in GitHub Desktop.
import Prelude
import Control.Exception
main = do
input <- getLine
let parsedNum = (read input::Double)
result <- try (print parsedNum) :: IO (Either IOException ())
case result of
Right () -> putStrLn "Great Success! "
Left e -> do
putStrLn "EXCEPTION! Operation was a success, but patient died."
putStrLn $ show e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment