
#11534: Allow class associated types to reference functional dependencies -------------------------------------+------------------------------------- Reporter: ekmett | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: TypeFamilies, Resolution: | FunctionalDependencies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AntC): Replying to [comment:30 dfeuer]:
I think the choice to reuse `->` was a bit fishy from the start.
I'd have no objection to using some symbol other than `::` if you'd
The arrow was borrowed straight from database Functional Dependencies. (I guess it helped that `->` was already a recognised lexeme.) But note that Mark Jones' original proposal was that FunDeps should look like this {{{ class Foo a b c d | {a} -> {b, c}, {b, d} -> {a} where ... }}} IOW: the determinant and dependent are sets of parameters (order immaterial). That's exactly how they look in database theory. `b d` does indeed excite in my brain that is tyvar `b` applied to `d`. (The Haskell abbreviated form was also taken over into injective type families, where it gives a potential syntactic ambiguity.) So the fishiness arose from dropping the set notation braces with commalist. prefer. Aside from how to bind naming for a FunDep, beware that a Type Familiy's parameters are positional whereas a FunDep's are not. IOW this is (supposed to be) an entirely equivalent class decl {{{ class Foo a b c d | d b -> a, a -> b c }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11534#comment:33 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler