[GHC] #7401: Can't derive instance for Eq when datatype has no constructor, while it is trivial do do so.
GHC
cvs-ghc at haskell.org
Sun Apr 14 14:25:02 CEST 2013
#7401: Can't derive instance for Eq when datatype has no constructor, while it is
trivial do do so.
---------------------------------+------------------------------------------
Reporter: jpbernardy | Owner:
Type: feature request | Status: infoneeded
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.6.1
Keywords: deriving | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: GHC rejects valid program
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by jpbernardy):
Basically what kosmikus said. This occurs often when you do generic
programming. ie, when you encode the type A as A + 0 where 0 is a type
with no constructor and + is an either-like type.
So: yes, I have seen this in real programs. It's not too hard to write an
instance manually, but the error message is confusing. I suspect that a
proper fix (allowing to derive an instance) should be very easy, if it is
not the case, a better error message (hinting at the user to write an
instance with 'undefined') would also be an acceptable fix.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7401#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list