Last active
December 17, 2015 20:09
-
-
Save LeifWarner/5665795 to your computer and use it in GitHub Desktop.
This file contains 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
// defined on List[A], theoretically | |
def filterM[M](p: A=>M[A]): M[A] = for { | |
flg <- p(this.head) | |
ys <- this.tail.filterM(p) | |
} yield if (flg) this.head :: ys else ys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment