Created
September 16, 2013 17:05
-
-
Save warpr/6583496 to your computer and use it in GitHub Desktop.
This file contains 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 System.Exit( exitWith, ExitCode(..) ) | |
exit = exitWith ExitSuccess | |
die = exitWith $ ExitFailure 1 | |
readSomething :: String -> Either String String | |
readSomething s = Right (s ++ " -> 200 OK") | |
readSomethingElse :: String -> Either String String | |
readSomethingElse s = Left (s ++ " -> 404 NOT FOUND") | |
doStuff = readSomething "aap" | |
main = case doStuff of | |
Right something -> putStrLn something >> exit | |
Left errmsg -> putStrLn errmsg >> die |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment