- Learning Functional Programming in Go
- Lex Sheehan
- 97字
- 2021-07-02 23:13:47
Ord algebra
Here're the Ord rules:
The values used in the rules are a, b and c. A value which has a Setoid must provide an lte method. The lte method is this algebra's operator and it takes one argument.
From the preceding diagram, we see that an Ord is a Setoid, so the Ord has an Equals operator and the Ord must obey the same rules that a Setoid does, as well as its own rules.
Later in our book, we'll explore Haskell's type class hierarchy and look at the Functor, Monoid, and Monad algebras.