Skip to content

Instantly share code, notes, and snippets.

@mheinzel
Created August 16, 2017 13:07
Show Gist options
  • Save mheinzel/f15fbbb441b90cfedeab4fb56203a586 to your computer and use it in GitHub Desktop.
Save mheinzel/f15fbbb441b90cfedeab4fb56203a586 to your computer and use it in GitHub Desktop.
import Control.Monad.Trans.Maybe
import Control.Monad.IO.Class (liftIO)
prog x = do
print "hi"
runMaybeT $ do
Right y <- return x
liftIO $ print y -- will only be executed if x matched the pattern `Right y`
print "bye"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment