Thursday, 3 October 2013

Monoid type annotation

Monoid type annotation

In the book Functional Programming in Scala I see the following signature:
def productMonoid[A,B](A: Monoid[A], B: Monoid[B]): Monoid[(A,B)]
The description says that:
if types A and B are monoids, then the tuple type (A, B) is also a monoid
I have a difficulty in understanding the following part:
A: Monoid[A]
A is of type Monoid which takes itself as a type parameter? How to
understand that?

No comments:

Post a Comment