[GHC] #8707: Kind inference fails in data instance definition
GHC
ghc-devs at haskell.org
Tue Mar 11 01:51:09 UTC 2014
#8707: Kind inference fails in data instance definition
-------------------------------------+------------------------------------
Reporter: goldfire | Owner: jstolarek
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by goldfire):
Quite right. But, your comment about the fact that this works for data
instances gives me an idea: what about doing this unification in
`kcDataDefn`? Note that the function is used only in the data instance
case. (It might be worth renaming to make this now-critical fact more
obvious.) There's no knot to worry about there. `kcConDecl` would be
rewritten to return the desugared result type so that `kcDataDefn` can
access it. Should be rather straightforward.
If you agree that this might work, the question now is: is it better to
have this (admittedly somewhat delicate) check in addition to the already-
delicate handling of GADT return types? Or is it better to have a
duplication of all the work in `tc_hs_type`? If we go with duplicating
`tc_hs_type`, it's not immediately obvious exactly how the GADT-return-
type typechecker would operate, given that the constraints on that type
may appear arbitrarily deep in the type, depending on the data instance
type patterns. I'm sure there's a way to get it to work, but I have a
sneaking suspicion it will look a lot like a call to `unifyType`
somewhere.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8707#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list