Skip to content

Instantly share code, notes, and snippets.

@paulp
Created August 23, 2018 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulp/244846ffa026ac7bfed3bf57ea0398db to your computer and use it in GitHub Desktop.
Save paulp/244846ffa026ac7bfed3bf57ea0398db to your computer and use it in GitHub Desktop.
instance Monad f => Monad (OptionalT f) where
f =<< x = OptionalT $ runOptionalT x >>= \case
Empty -> return Empty
Full a -> runOptionalT $ f a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment