Open chris-martin opened 5 years ago
I think having an universal construction is a good reason for defining a type class.
I feel the Geometry is a bit too trivial for the example. I think a more real world example is semigroup (though haskell cannot gurantee associativity easily).
If you like, I can make a PR on it.
We wrote this a while back to show what defining your own typeclass looks like. I'm not sure whether I like it, or whether this is actually a good topic for a Phrasebook page (because "I want to define a typeclass" is not an end goal in itself). It would be cool to include an example like this if we could figure out how to motivate it better and change the title to something that is an understandably practical objective.