|
|
|
# Extension Name
|
|
|
|
|
|
|
|
|
|
|
|
See [ExtensionDescriptionHowto](extension-description-howto) for information on how to write these extension descriptions. Please add any new extensions to the list of [HaskellExtensions](haskell-extensions).
|
|
|
|
|
|
|
|
## Brief Explanation
|
|
|
|
|
|
|
|
|
|
|
|
Associated types are data type and type synonym declarations in type classes. They are useful to denote type-indexed data types (i.e., generic programming) and functions over types. Applications include the typical applications of functional dependencies, but also self-optimising libraries and APIs that resemble ML module signatures.
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
- [ Associated Types with Class](http://www.cse.unsw.edu.au/~chak/papers/CKPM05.html) by Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow, in POPL'05.
|
|
|
|
- [ Associated Type Synonyms](http://www.cse.unsw.edu.au/~chak/papers/CKP05.html) by Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones, in ICFP'05.
|
|
|
|
- [ phrac](http://www.cse.unsw.edu.au/~pls/repos/phrac/) (Darcs repo) is a prototype implementation of HM type inference with ATs.
|
|
|
|
|
|
|
|
## Pros
|
|
|
|
|
|
|
|
- Associated types are a functional alternative to [FunctionalDependencies](functional-dependencies), which are actually relational. (Why use relational programming on the value level if we don't do it on the value level?)
|
|
|
|
- They avoid some problems with FDs (described in the above papers).
|
|
|
|
- They closes the gap reported in [ A comparative study of language support for generic programming](http://www.osl.iu.edu/publications/prints/2003/comparing_generic_programming03.pdf)
|
|
|
|
|
|
|
|
## Cons
|
|
|
|
|
|
|
|
- Only a prototype implementation so far |