
8 Jan
2016
8 Jan
'16
6:13 a.m.
On Fri, Jan 08, 2016 at 05:55:45PM +0800, Lian Hung Hon wrote:
How should one go about deciding to use data or class? Is there a semantic difference?
Classes are not first class citizens in Haskell, and it's very hard to pass them around, manipulate them and compute with them without using non-standard and awkward techniques.
Which is more appropriate here?
Almost certainly data. My rule of thumb is to only introduce a typeclass once it becomes incredibly repetitive passing around the data explicitly. Tom