Created
January 25, 2017 15:16
-
-
Save evincarofautumn/c9f84a9ea159d1dea19c33e3645d3e77 to your computer and use it in GitHub Desktop.
Ironically named PureMonad class
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
class (Monad m) => PureMonad m where | |
run :: m a -> a | |
instance PureMonad Maybe where | |
run = fromJust | |
instance PureMonad (Either a) where | |
run = fromRight | |
instance PureMonad [] where | |
run = head | |
instance PureMonad IO where | |
run = unsafePerformIO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment