I am curious where the method scalaz.Bind.bind is implemented? Thanks
trait Bind[F[_]] extends Apply[F] { self =>
////
/** Equivalent to `join(map(fa)(f))`. */
def bind[A, B](fa: F[A])(f: A => F[B]): F[B]
...
I am looking at 7.3.0-SNAPSHOT source.
Bindfollows typeclass pattern, and those tend to have multiple implementations for different types that support operations defined by them. That implementations called typeclass instances. Most of the Scalaz typeclass instances for Scala standard library classes reside inscalaz.stdpackage. Examples:Bind[List]:listInstancesimplicit value inscalaz.std.ListInstacestrait, defined in scalaz/std/List.scala. It can be imported viascalaz.std.listobject (in the same file) orscalaz.Scalazobject (in scalaz/Scalaz.scala), both of which extend theListInstancestrait.Bind[Option]:optionInstancesimplicit value insclaaz.std.OptionInstances, defined in scalaz/std/Option.scala. It can be imported viascalaz.std.optionobject (in the same file) orscalaz.Scalazobject (in scalaz/Scalaz.scala), both of which extend theOptionInstancestrait.You can also create Scalaz typeclass instances for your own types by creating implicit values or conversions that implement one or more corresponding traits. To be visible, implicits must be imported into your context.