Created
October 27, 2016 17:53
-
-
Save mmollaverdi/7aa392fcbf975ddb7b3355f79774fb61 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
implicit val OptionApplicative = new Applicative[Option] { | |
def ap[A, B](ff: Option[A => B])(fa: Option[A]): Option[B] = for { | |
f <- ff | |
a <- fa | |
} yield f(a) | |
def pure[A](a: A): Option[A] = Option(a) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment