[GHC] #11534: Allow class associated types to reference functional dependencies
GHC
ghc-devs at haskell.org
Mon Feb 8 19:21:24 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):
Consider the rather similar definitions of A and B below:
{{{#!hs
{-# language FunctionalDependencies, TypeFamilies, MultiParamTypeClasses,
GeneralizedNewtypeDeriving #-}
class A s m | m -> s
instance A () Int
class B m where
type S m :: *
instance B Int where
type S Int = ()
}}}
Now,
{{{#!hs
newtype X = X Int deriving (A ())
}}}
works, but
{{{#!hs
newtype X = X Int deriving (B)
}}}
complains
{{{
• Can't make a derived instance of ‘B X’
(even with cunning GeneralizedNewtypeDeriving):
the class has associated types
• In the newtype declaration for ‘X’
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11534#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list