Lars Hupel
unread,May 18, 2013, 3:30:34 PM5/18/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sca...@googlegroups.com
Recently I've been wondering about the instance-specific syntax:
val LM = Monad[List]
import LM.monadSyntax._
Now, one can write:
1.pure
and the compiler can actually figure out what is meant. Without
instance-specific syntax, one would have to write:
1.pure[List]
Does anybody actually use that feature?
I would really like to see that go away, because it seems odd to me: why
would you want to use syntax only for one specific `Monad`/...? (Also,
it introduces redundancy in `FunctorSyntax` and `ApplicativeSyntax`.)
Anyway, I tried removing it, and it's not too much of a hassle. As far
as I can see, only three functions are affected, with the most important
being `pure`/`pointed`. There are a few places in the examples which
won't compile any more – where `0.pure` is used to put a value into a
`State`:
val S = scalaz.StateT.stateMonad[(Int, Int)]
import S.monadSyntax._
0.pure
There are two possible workarounds:
S.pure(0)
and
import scalaz.syntax.applicative._
type IState[α] = State[(Int, Int), α]
0.pure[IState]
I think that is not too bad.