Re: [GHC] #7401: Can't derive instance for Eq when datatype has no constructor, while it is trivial do do so.

#7401: Can't derive instance for Eq when datatype has no constructor, while it is trivial do do so. -------------------------------------+------------------------------------- Reporter: jpbernardy | Owner: osa1 Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.1 Resolution: | Keywords: deriving, Operating System: Unknown/Multiple | newcomer Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D978 -------------------------------------+------------------------------------- Comment (by jpbernardy): I just read the proposed documentation on Phabricator. There is something that I think is dissatisfying with the implementation. As I understand it, the contract expressed by an empty data type is that there should be no value inhabiting it. So, if a piece of program ever builds one, the blame should be assigned to that piece of code. However, it does not appear that the current implementation does this. Eg: (error "oops" :: Foo) `compare` (error "oops" :: Foo) should fail with "oops", not "compare on empty data type Foo" Similarly, a Read instance makes no sense imho. Please, consider forcing the arguments in all these instances, before failing. Finally, I realise that my original report was misleading. I am sorry for that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7401#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC