Last active
December 30, 2015 08:49
-
-
Save JakubOboza/7804859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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