#380 GHC2021: What's wrong with Functional dependencies

Dear all, It seems that a number of us have voted against including FunctionalDependencies and TypeFamilyDependencies. I don't understand why. They are properly guarded by syntax. I don't know any complaint against them FunctionalDependencies, at least, is as standard as it gets (there are functional dependencies all over the mtl). Is it an oversight? Or do some of us really believe that we ought to keep these out, and why? /Arnaud

I voted "maybe", since I wasn't unsure about FunctionalDependencies. My
line of thought was "since only the creator of the class has to enable it,
it's not so terrible". On the other hand, I agree with your comment about
being properly guarded by syntax, which is sort of my golden rule.
About TypeFamilyDependencies, I think it's too early for inclusion. I don't
think the design has settled yet, in particular because you cannot write
very complex dependencies right now.
El vie, 4 dic 2020 a las 13:44, Spiwack, Arnaud (
Dear all,
It seems that a number of us have voted against including FunctionalDependencies and TypeFamilyDependencies.
I don't understand why. They are properly guarded by syntax. I don't know any complaint against them FunctionalDependencies, at least, is as standard as it gets (there are functional dependencies all over the mtl).
Is it an oversight? Or do some of us really believe that we ought to keep these out, and why?
/Arnaud _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

We’re back to “what is GHC2021 for?” Maybe we need to refine the criteria.
Arnaud seems to be saying “anything that is guarded by its own syntax, and is widely used, should go in”. But GHC2020 is also saying “these are blessed extensions that are well understood and we expect to be part of the language forever”.
You could argue that fundeps are in that class. But let’s not forget the “expect to be part of the language forever”. For me, standalone kind signatures are definitely “forever”. But fundeps – because they don’t carry evidence, as they stand – feel less solidly rooted.
Simon
From: ghc-steering-committee

On Fri, Dec 4, 2020 at 3:07 PM Simon Peyton Jones
But fundeps – because they don’t carry evidence, as they stand – feel less solidly rooted.
Can you elaborate? I don't understand where you are coming from yet. (for the record: I'm not applying just “guarded by their own syntax” as a criterion, for me, this criterion is a sufficient condition for “no surprising new errors”. I also believe (believed?) that functional dependencies were quite standard and expected them to be here forever. I took TypeFamilyDependency to be a mild extension. I'm perfectly willing to be convinced otherwise.)

Can you elaborate? I don't understand where you are coming from yet.
In haste,
* Many open tickets about fundepshttps://gitlab.haskell.org/ghc/ghc/-/issues?label_name=FunctionalDependencie...… still open because of lack of agreement about what the Right Thing is, not because the implementation is difficult
* As originally proposed they are quite restrictive (the Coverage Condition). Many uses of fundeps use a more liberal coverage condition, currently enabled by UndecidableInstances. I’m not sure if “Many” means “most” or just “a minority”; data needed.
* Fundeps affect unification in type inference, and have no effect in Givens, unlike type families. Nothing inherently wrong with that, but it feels unsatisfying that we can know that t1~t2 (from a fundep between two givens) but can’t exploit that fact.
They are undoubtedly useful. I’m not arguing for removal. They have just never felt as solid to me as other parts of our type system.
Simon
From: Spiwack, Arnaud

I like functional dependencies but I don't think they should be on by
default. My main reason is that I don't know what's a good way to check FD
consistency: I find the original FD consistency check to be a bit too
conservative, and the liberal coverage condition turned out to be unsound
(e.g. See Tom Schrijvers's paper about FDs). I guess in part for such
reasons GHC has been very conservative about how it uses them (e.g., it
won't use them on given constraints). This has led to a bunch of confusion
about what *is* a FD at all... So I don't think their
design/implementation is in its final form, which is why I don't think the
extension should be on by default.
On Fri, Dec 4, 2020 at 6:29 AM Simon Peyton Jones via
ghc-steering-committee
Can you elaborate? I don't understand where you are coming from yet.
In haste,
- Many open tickets about fundeps https://gitlab.haskell.org/ghc/ghc/-/issues?label_name=FunctionalDependencie...… still open because of lack of agreement about what the Right Thing is, not because the implementation is difficult - As originally proposed they are quite restrictive (the Coverage Condition). Many uses of fundeps use a more liberal coverage condition, currently enabled by UndecidableInstances. I’m not sure if “Many” means “most” or just “a minority”; data needed. - Fundeps affect unification in type inference, and have no effect in Givens, unlike type families. Nothing inherently wrong with that, but it feels unsatisfying that we can know that t1~t2 (from a fundep between two givens) but can’t exploit that fact.
They are undoubtedly useful. I’m not arguing for removal. They have just never felt as solid to me as other parts of our type system.
Simon
*From:* Spiwack, Arnaud
*Sent:* 04 December 2020 14:13 *To:* Simon Peyton Jones *Cc:* GHC Steering Committee *Subject:* Re: [ghc-steering-committee] #380 GHC2021: What's wrong with Functional dependencies On Fri, Dec 4, 2020 at 3:07 PM Simon Peyton Jones
wrote: But fundeps – because they don’t carry evidence, as they stand – feel less solidly rooted.
Can you elaborate? I don't understand where you are coming from yet.
(for the record: I'm not applying just “guarded by their own syntax” as a criterion, for me, this criterion is a sufficient condition for “no surprising new errors”. I also believe (believed?) that functional dependencies were quite standard and expected them to be here forever. I took TypeFamilyDependency to be a mild extension. I'm perfectly willing to be convinced otherwise.) _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
participants (4)
-
Alejandro Serrano Mena
-
Iavor Diatchki
-
Simon Peyton Jones
-
Spiwack, Arnaud