This is the root page for examples and issues about functional dependencies in GHC.
Main sub-pages
IMPORTANT This list of sub-pages have most of the content!
The rest this page gathers other useful links.
Key papers
- Type classes with functional dependencies, Mark Jones, ESOP 2000. The original fundep paper.
- Understanding functional dependencies via constraint handling rules, Sulzmann et al, JFP 2006. This journal paper has a lot of examples and we cite it frequently below as "JFP-paper".
- Elaboration on functional dependencies, Karachalias and Schrijvers, Haskell Symposium 2017. This paper shows how to translate functional dependencies into type families.
- Evidenced functional dependencies a wiki page developing the Karachalias and Schrijvers paper further.
Key proposals
- Coverage condition: Per-instance DYSFUNCTIONAL pragma.
- Instance consistency condition: Explore ways to weaken or abandon the Instance Consistency Condition.
GHC today
GHC today does this:
-
By default: GHC uses the strict coverage condition and imposes the Paterson conditions.
-
If
UndecidableInstances
is on, GHC- uses the liberal (not strict) coverage condition
- lifts the Paterson conditions
-
Always: GHC implements liberal instance consistency unconditionally. See
Note [Bogus consistency check]
inGHC.Tc.Instance.Fundeps
. (GHC presumably does this because SICC is incompatible with LCC.)