Is there any way how can I figure out the whole implicit chain (and I am interested in all of the implicit kinds). I'm using IntelliJ Idea, but I'm searching for any way to do that, even if I have to work with another IDE. (and I'm wondering whether REPL can help me with that)
For example I write a gt b
where gt
comes from scalaz
. And I want to know:
Order
was used a
received a method gt
. For this particular example, I know that ToOrderOps
trait was used, but in general I may not know that and I also can't figure out how ToOrderOps
was imported.Using the Scala reflection API in the REPL is usually a good way to start this kind of investigation:
scala> import scala.reflect.runtime.universe.reify
import scala.reflect.runtime.universe.reify
scala> import scalaz._, Scalaz._
import scalaz._
import Scalaz._
scala> println(reify(1 gt 2))
Expr[Boolean](Scalaz.ToOrderOps(1)(Scalaz.intInstance).gt(2))
scala> println(reify("a" gt "b"))
Expr[Boolean](Scalaz.ToOrderOps("a")(Scalaz.stringInstance).gt("b"))
The ToOrderOps
here is a method, not the trait, and the Scalaz
indicates that you're seeing it because scalaz.Scalaz
mixes in the ToOrderOps
trait, so I think this approach addresses all three of your points.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With