Skip to content

Instantly share code, notes, and snippets.

@evincarofautumn
Created January 25, 2017 15:16
Show Gist options
  • Save evincarofautumn/c9f84a9ea159d1dea19c33e3645d3e77 to your computer and use it in GitHub Desktop.
Save evincarofautumn/c9f84a9ea159d1dea19c33e3645d3e77 to your computer and use it in GitHub Desktop.
Ironically named PureMonad class
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