I thought that every monad in scalaz
had also an Applicative
instance. For example, I can use ApplicativeBuilder
for Option
like this:
scala> (1.some |@| 2.some) {_ + _}
res1: Option[Int] = Some(3)
Now I'd like to do the same with Reader
:
scala> type IntReader[A] = Reader[Int, A]
defined type alias IntReader
scala> val r1: IntReader[Int] = Reader {x: Int => x + 1 }
r1: IntReader[Int] = Reader(<function1>)
scala> val r2: IntReader[Int] = Reader {x: Int => x + 2 }
r2: IntReader[Int] = Reader(<function1>)
scala> (r1 |@| r2) {_ + _}
<console>:64: error: value |@| is not a member of IntReader[Int]
(r1 |@| r2) {_ + _}
Why doesn't this code above compile ?