#5481: Associated type defaults + MultiParamTypeClasses error
----------------------------------------+-----------------------------------
Reporter: illissius | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.3
Resolution: fixed | Keywords:
Testcase: | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: GHC rejects valid program |
----------------------------------------+-----------------------------------
Comment(by illissius):
Hmm. Intuitively, though, taking the original example:
{{{
class Foo a b where
type X a
type X a = b
type Y b
type Y b = a
}}}
The default associated types aren't actual type family instance
declarations, otherwise they'd result in overlap every time a specific
instance chose a different RHS from the default. The defaults only get
instantiated (if that's the right terminology) when an instance for the
class is actually declared.
So if I write
{{{
instance Foo Int Char
}}}
what that really means is
{{{
instance Foo Int Char where
type X Int = Char
type Y Char = Int
}}}
No type variables on the RHS!
There'd be nothing at all preventing me from writing that manually, or
from writing it the same way at the top level with non-associated type
families. It'd merely be longer.
Am I wrong?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5481#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs