#3012: A little deriving for GADTs
---------------------------------+------------------------------------------
Reporter: guest | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: minor | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Changes (by simonpj):
* difficulty: => Unknown
Comment:
Good suggestion. In general I'm all for it. But why just `Show`? And is
enumerations the right restriction? I suppose you could say that any
extra stuff is an improvement, but the less ad hoc the better.
In general, to do 'deriving' you need to solve two problems
1. Figure out the right context for the instance declaration.
2. Guarantee the the code generated for the instance will typecheck.
There are plenty of details. For example, (1) isn't necessary for
"standalone deriving" because the programmer specifies the context. If he
specifies the wrong context, the generated instance may not typecheck, so
we cannot guarantee (2). So perhaps we should accept ANY data type (GADT
or whatever) with standalone deriving, and say "it's your fault" if the
derived code doesn't typecheck?
I don't have a strong position on any of this. If someone wants to figure
out the detailed spec, implementation is probably not hard.
Simon
(Lennart, are you sure you don't want a Trac login of your own?)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3012#comment:1>
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