November 2017
Intermediate to advanced
670 pages
17h 35m
English
Type classes allow us to define behavior on types.
As discussed in Chapter 3, Using High-Order Functions, type classes add an additional layer to our type system.
We accomplish this by:
Let’s look at our Equals type class implementation.
Parent class definition:
//4-purely-functional/ch11-monads/05_typeclasss/src/typeclass/equals.gopackage typeclassimport ( "strconv")type Equals interface { Equals(Equals) bool}
Equals is our parent type class. All base classes must implement the Equals method.