Performance benchmarking, notes and examples for numhask
numhask is an experimental library, involving representation of a numeric heirarchy of haskell classes. The closest library to this (apart from the prelude) is kmett's algebra. Three years ago, when reddit was fun and kind, Kmett had this comment about deep class heirarchies:
"In a language that didn't penalize deep accurate class hierarchies, I would agree. Haskell is not that language. I've built such a hierarchy before on multiple occasions. It is nigh unusable for library implementors. You get zero code-reuse, and every point in the lattice of laws and members requires an instance. As you add dimensions of laws the curse of dimensionality gives you an explosive number of points.
Consequently, in Haskell, I've taken to adopting a more pragmatic approach, which is that I generally try not to introduce any type class that merely introduces a law, unless that law is accompanied by an operation."
All good and wise for library design except not so good for haskell programmers where thinking about the problem at hand is so tied up with the abstractions at hand. As a consequence, thinking about the correct class heirarchy for the exact problem is given short work.
notes on algebra
This is the tower needed for working on a Hilbert space. What is the unique Free object for this???
Divisible is an existence law-only class ie
∀ a, b ∈ T: a / b ∈ T
newtype Prob s a = Prob (List (s, a))