[Haskell-cafe] What are Kind errors and how do you fix them?

S. Alexander Jacobson alex at i2x.com
Mon Mar 29 17:56:46 EST 2004

I want to thank everybody for the kind
explanations of kind errors.

I think I now understand them (figured it out
through a LOT of trial and error).  The problem
(as Carl and others noted) was I was testing
various ways of doing things using synonyms rather
than data types and didn't know that you can't do

Based on my recent experience as a new coder,
here are some words of advice for future

* Beware the monomorphism restriction!
* Avoid type synonyms in instance declarations!
* use newtype whenever possible (also see quickcheck docs)
* you can't use existential types except through class methods!
* you must wrap existential types if you want to
  use them in record-style data declarations
  (No, I have no idea why this is, but it
   appears to be true nonetheless)

The problem with this sort of list is that it is
probably only useful after you have already made
these mistakes.   Oh well.


S. Alexander Jacobson                  mailto:me at alexjacobson.com
tel:917-770-6565                       http://alexjacobson.com

More information about the Haskell-Cafe mailing list