Personal tools

Slim instance declaration

From HaskellWiki

Revision as of 11:10, 25 October 2006 by Lemming (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is an excerpt from "Disclipline for re-use: Slim instances"

All instance declarations should be slim.

This means

  • Instance declarations (and default definitions) should never contain non-trivial function definitions.
  • Instance declarations (and default definitions) should only provide "plumbing" to make existing functions accessible via the type class resolution mechanism.
  • The "plumbed" functions should always be exported (since instances are always exported).

Since the naming will not always be straight-forward, the last point is particularly important and would enable more re-use and less re-invention of mostly trivial wheels.