[Haskell-cafe] Data declaration vs type classes
Tom Ellis
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Jan 8 11:13:06 UTC 2016
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
More information about the Haskell-Cafe
mailing list