Here: A: Monoid[A]
the is just a variable name, it can also be written as a: Monoid[A]
or param1: Monoid[A]
. It it a bit of convention to give such variable names, for example in most cases variable name for a functor is F - F: Function[A]
and M for a Monad - M: Monad[A]
:
abstract class SomeClass[TC[_], A](param: TC[A]) {
implicit val M: Monad[TC]
... // other code
}
It's more readable and clear if you see something like M.point[TC]
where M is an instance of a Monad
.
Added
And A: Monoid[A]
is not a type annotation at all. Type parameters are written in square brackets:
def productMonoid [A,B] (params...), so in this variant:
def productMonoid[A: Monoid,B](params...)
Yes Monoid[A]
is a type class for A
type, it's desugared into:
def productMonoid[A,B](params...)(implicit val $ev: Monoid[A])
This means that Monoid
is a type constructor which takes a type A
and constructs a type Monoid[A]
for $ev
.