Created
November 18, 2010 13:32
-
-
Save debasishg/704973 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
scala> import scalaz._ | |
import scalaz._ | |
scala> import Scalaz._ | |
import Scalaz._ | |
scala> implicitly[Applicative[Option]] | |
res0: scalaz.Applicative[Option] = scalaz.Applicative$$anon$1@78b973 | |
scala> val f = ((_: Int) * (_: Int)).curried | |
f: (Int) => (Int) => Int = <function1> | |
scala> Some(10) <*> (Some(20) map f) | |
<console>:19: error: type mismatch; | |
found : Option[(Int) => Int] | |
required: Some[(Int) => ?] | |
Some(10) <*> (Some(20) map f) | |
^ | |
scala> val o1: Option[Int] = Some(10) | |
o1: Option[Int] = Some(10) | |
scala> val o2: Option[Int] = Some(20) | |
o2: Option[Int] = Some(20) | |
scala> o1 <*> (o2 map f) | |
res2: Option[Int] = Some(200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment