[GHC] #8630: Kind inference fails to account for associated types
GHC
ghc-devs at haskell.org
Sat Dec 28 14:28:27 UTC 2013
#8630: Kind inference fails to account for associated types
--------------------------------------------+------------------------------
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by simonpj):
I suppose you are right here. But I think it'll take quite a bit of code
to do the Right Thing here. The Right Thing is, I suppose, to walk over
the associated-type declarations of the instance, and gather any kind
constraints they generate. But consider something like this:
{{{
instance C (T a) where
type F (T a) b = b -> a
}}}
Here we must bring 'b' into scope before doing kind-checking on the RHS of
the type instance. And then there are data families. This all duplicates
the code we subsequently use for typechecking those type/data instances.
Fiddly.
Moreover, you could argue the same for ''value'' declarations too:
{{{
instance C (T a) where
op x y = [x, y::a -> a]
}}}
There's a type signature deep in the term that constrains the kind of 'a'.
It would arguably be inconsistent to look at ''type'' instances but not
''value'' instances. And we really really are not going to look into the
value terms!
So I'm not sure it's worth fixing this.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8630#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list