A type A
and an implementation of Monoid[A]
that satisfies the three laws:
- Closure: the result of combining two things is always another one of the things.
- Associativity: When combining more than two things, order doesn't matter.
- Identity element: There is a special thing called "zero" such that when you combine any thing with "zero" you get the original thing back.
A type that you can apply to type arguments to 'construct' a type. They act like functions, but on the type level. List
is a type constructor. You can't just have a List
, you have to have a List[A]
. Here, A
is a type parameter.
From "The Neophyte's Guide":
A type class
C
defines some behaviour in the form of operations that must be supported by a typeT
for it to be a member of type classC
. They allow ad-hoc and retroactive polymorphism.
???
- Monoids in practice
- What is a higher-kinded type in Scala?
- Higher-kinded types: the difference between giving up, and moving forward
- Scala Types of Types
- [Neophyte's Guide: Type Classes][tc]
[tc] http://danielwestheide.com/blog/2013/02/06/the-neophytes-guide-to-scala-part-12-type-classes.html