[GHC] #11534: Allow class associated types to reference functional dependencies
GHC
ghc-devs at haskell.org
Wed Feb 3 21:44:53 UTC 2016
#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 ekmett):
Let's expand your example and see.
{{{#!hs
class C a b | a -> b where
type Bar a
type Bar a = b
class D a b | a -> b
instance D Int Bool
instance D a b => C [a] [b]
}}}
If we have a functional dependency on `D` from `a -> b`, that secretly
builds some type family for us, we use behind the scenes, right?
Let's say that `D_ab` is the "hidden" type family implied by the
functional dependency from `a -> b` then the expansion of
{{{#!hs
instance D a b => C [a] [b]
}}}
would be
{{{#!hs
instance D a b => C [a] [b] where
type Bar [a] = [D_ab a]
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11534#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list