Skip to content

Instantly share code, notes, and snippets.

@jneira
Created December 19, 2010 22:01
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 jneira/747738 to your computer and use it in GitHub Desktop.
Save jneira/747738 to your computer and use it in GitHub Desktop.
def ifM[B](t: => M[B], f: => M[B])(implicit a: Monad[M], b: A <:< Boolean): M[B] =
>>= ((x: A) => if (x) t else f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment