#1496: Newtypes and type families combine to produce inconsistent FC(X) axiom
sets
----------------------------------------+-----------------------------------
Reporter: sorear | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler (Type checker) | Version: 6.7
Severity: critical | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
----------------------------------------+-----------------------------------
Comment (by SamB):
Okay, it seems to me that in order to solve this problem, GHC needs to be
able to prove, somehow or other, that each method to be derived can be
safely converted from the one type to the other. Correct?
And the main choice here is whether it should
A. try to do this on it's own, and prove that it can just cast between
the one and the other or
B. require the user to explicitly provide Functor, BiFunctor, etc.
instances for GHC to use during this process,
yes?
Probably it is best to take an approach that we can be sure is safe
without too many aspirins, and use approach B, but have GHC issue a
warning whenever it is unable to optimize away the coercions for some of
the methods, and therefore unable to re-use the dictionary.
The rules for the derivation itself should preferably be written up in a
paper so that the other compilers, too, can benefit from this extremely
convenient feature, though doubtless it will become somewhat less
convenient in some ways if this bug is fixed.
For this approach to work well with multi-parameter types, however, we'd
presumably need to add a lot more Functor-related classes to base, would
we not?
But which ones?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1496#comment:22>
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