
#11534: Allow class associated types to reference functional dependencies -------------------------------------+------------------------------------- Reporter: ekmett | Owner: 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 adamgundry): Going back to imagining something more ambitious to tackle the original issue, how feasible would it be to take a class {{{#!hs class Foo i j | i -> j instance Foo Int Bool }}} and elaborate it into something like {{{#!hs class j ~ Foo_FD1 i => Foo i j where type Foo_FD1 i :: * instance Foo Int Bool where type Foo_FD1 Int = Bool }}} so that functional dependencies really would build a type family behind the scenes, and the class would carry explicit evidence? This would make it possible for given constraints involving fundeps to work properly, which they don't at present (as [https://mail.haskell.org/pipermail/ghc- devs/2016-March/011502.html Iavor points out]). Of course, we'd need to figure out how the user should be allowed to refer to such type families, and how the constraint solver should treat them. Moreover, this translation might break programs that are abusing fundeps (comment:16). But perhaps it would be worth exploring. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11534#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler