Created
February 16, 2012 21:04
-
-
Save jvranish/1847835 to your computer and use it in GitHub Desktop.
WordpressIsEatingMyHaskell
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
let result = do | |
account <- getAccount person | |
lastTransaction <- getLastTransaction account | |
getAmount lastTransaction | |
case result of | |
Nothing -> putStrLn "Oh noes!" | |
Just a -> putStrLn ("The amount was: " ++ show a) | |
-- Or really, I'd actually do this: | |
let result = getAmount =<< getLastTransaction =<< getAccount person | |
case result of | |
Nothing -> putStrLn "Oh noes!" | |
Just a -> putStrLn ("The amount was: " ++ show a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment