Commit 231aa4bd authored by Simon Marlow's avatar Simon Marlow
Browse files

Integrate EmptyDataDecls

parent d51bc682
......@@ -24,7 +24,7 @@ body -> @{@ impdecls @;@ topdecls @}@
topdecls -> topdecl_1 @;@ ... @;@ topdecl_n & (n>=1)
topdecl -> @type@ simpletype @=@ type
| @data@ [context @=>@] simpletype @=@ constrs [deriving]
| @data@ [context @=>@] simpletype \hprime{[}@=@ constrs\hprime{]} [deriving]
| @newtype@ [context @=>@] simpletype @=@ newconstr [deriving]
| @class@ [scontext @=>@] tycls tyvar [@where@ cdecls]
| @instance@ [scontext @=>@] qtycls inst [@where@ idecls]
......@@ -478,7 +478,7 @@ the top level of a module.
\label{datatype-decls}
@@@
topdecl -> @data@ [context @=>@] simpletype @=@ constrs [deriving]
topdecl -> @data@ [context @=>@] simpletype \hprime{[}@=@ constrs\hprime{]} [deriving]
simpletype -> tycon tyvar_1 ... tyvar_k & (k>=0)
......@@ -512,7 +512,7 @@ An algebraic datatype declaration has the form:
where "cx" is a context.
%\index{context!in data declaration@@in {\tt data} declaration}
This declaration
introduces a new {\em type constructor} "T" with one or more constituent {\em data
introduces a new {\em type constructor} "T" with \hprime{zero} or more constituent {\em data
constructors} "K_1, ..., K_n".
\index{data constructor}\index{type constructor}
In this Report, the unqualified term ``constructor'' always means ``data constructor''.
......
......@@ -49,6 +49,10 @@ If "C" is @Enum@, the type must be an enumeration.
There must be no explicit instance declaration elsewhere in the program that
makes "T u_1 ... u_k" an instance of "C".
% or of any of "C"'s superclasses.
\item
\hprime{If the data declaration has no constructors (i.e. when "n=0"),
then no classes are derivable (i.e. "m=0")}
\end{enumerate}
For the purposes of derived instances, a @newtype@ declaration is
treated as a @data@ declaration with a single constructor.
......
......@@ -467,7 +467,7 @@ cname -> var | con
@@@
topdecls -> topdecl_1 @;@ ... @;@ topdecl_n & (n>=0)
topdecl -> @type@ simpletype @=@ type
| @data@ [context @=>@] simpletype @=@ constrs [deriving]
| @data@ [context @=>@] simpletype \hprime{[}@=@ constrs\hprime{]} [deriving]
| @newtype@ [context @=>@] simpletype @=@ newconstr [deriving]
| @class@ [scontext @=>@] tycls tyvar [@where@ cdecls]
| @instance@ [scontext @=>@] qtycls inst [@where@ idecls]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment