There is in fact an Applicative
instance for Reader
, which you can use like this (you should of course replace String
with whatever type you want your environment to be):
3.point[({type L[X] = Reader[String, X]})#L]
If you'd prefer to avoid the ugly type lambda and don't mind defining an extra type alias, you can write the following instead:
type MyReader[X] = Reader[String, X]
3.point[MyReader]
Scalaz 7 also provides a nice bit of shorthand that makes this even cleaner:
3.liftReader[String]
These are all more or less equivalent to each other (and to your solution), though.