... | ... | @@ -70,10 +70,12 @@ to syntactically allow a `deriving` clause after an empty data declaration, but |
|
|
contextual error since no interesting instances can be defined. Presumably the reasoning was that this
|
|
|
gives a more regular syntax and better error messages than ruling out deriving for empty declarations
|
|
|
syntactically. But the point is that there is a choice.
|
|
|
|
|
|
For this extension, probably the best course of action is to follow GHC and allow `deriving ()` clauses
|
|
|
for empty data declarations. That way no deriving clause and `deriving ()` still have the same semantics. To
|
|
|
do this, we syntactically allow all deriving clauses for empty data, but semantically limit the clauses to `deriving ()`.
|
|
|
References[ http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html\#nullary-types](http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#nullary-types) GHC documentation.
|
|
|
Report Delta
|
|
|
The changes to the report necessary to implement the proposal. Required for a proposal to move to the "accepted" state.
|
|
|
|
|
|
Replace the syntax in [ http://www.haskell.org/onlinereport/decls.html](http://www.haskell.org/onlinereport/decls.html)**4 Declarations and Bindings**:
|
|
|
|
|
|
topdecl → …
|
... | ... | @@ -94,7 +96,11 @@ This declaration introduces a new type constructor T with one or more constituen |
|
|
with
|
|
|
|
|
|
This declaration introduces a new type constructor T with zero or more constituent data constructors K1, …, Kn.
|
|
|
Download in other formats:[Plain Text](/wiki/EmptyDataDecls?version=8&format=txt)[](http://trac.edgewall.org/)Powered by [Trac 1.2.2](/about)
|
|
|
|
|
|
Also, in the description of when derived instances are possible for a class C [ http://www.haskell.org/onlinereport/derived.html\#derived-appendix](http://www.haskell.org/onlinereport/derived.html#derived-appendix), add the following condition.
|
|
|
If the data declaration has no constructors (i.e. when n=0), then no classes are derivable (i.e. m=0).
|
|
|
|
|
|
Download in other formats:[Plain Text](/wiki/EmptyDataDecls?version=9&format=txt)[](http://trac.edgewall.org/)Powered by [Trac 1.2.2](/about)
|
|
|
|
|
|
By [Edgewall Software](http://www.edgewall.org/).Visit the Trac open source project at
|
|
|
[http://trac.edgewall.com/](http://trac.edgewall.com/)
|
... | ... | |