Use of language extensions
(taken from a Haskell-Cafe mail)
(undecidable instances, overlapping instances)
Revision as of 10:43, 22 November 2006
Haskell compilers are full of experimental features. However, when it comes to designing libraries one should carefully think about which extensions to use and which not. Every required language extension and every imported library which on its own depends on such an extension, causes some of the following problems:
- It limits the range of Haskell compilers you can use.
- According to the availability of compilers on different platforms, it will also limit the range of machines it can be run on.
- It complicates the installation, if a user has to install a particular compiler to use your library.
- Many extensions are complicated enough to produce even more incomprehensible error messages, than errorneous Haskell 98 programs.
We suggest the following hierarchy of complexity with respect to types:
- Simple algebraic types
- H98 type classes
- Fancier instance heads (but still single-parameter, non-overlapping)
- Existential and local universal quantification
- GADTs (I'm still uncertain about this judgement, but they seem to be less troublesome than...)
- Multiparameter type classes with functional dependencies
- Multiparameter type classes including undecidable instances, overlapping instances