[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I would like to put in a plea for the Haskell syntax to allow empty
declarations (impdecls, fixdecls, topdecls and decls). This is to
aid those of us who automatically generate Haskell programs. The
effect would be to allow semicolon as a terminator or a separator
of declarations (since decl;decl; can be parsed as decl;decl;empty).
Let me try to convey the advantage of this scheme. Assume I have
generated a Haskell program consisting of a list of type declarations
and a list of value declarations. The natural way to print this is
to map some printing function over the type declarations, then do
the same thing to the value declarations.
The difficulty lies in where to put the semicolons: if they are
declaration separators, then they go between the type declarations
and between the value declarations and then an extra one between the types
and the values if and only if both lists are non-empty. This complicates
my printing process as I need an extra check for whether to place a
semicolon between the types and the values.
On the other hand, if empty declarations are allowed, so that semicolon
can be used as a declaration terminator, then we just put a semicolon
after every declaration. Easy.
The non layout-sensitive version of the syntax is there to help
automatic program generators and I think this change would make it even
National Physical Laboratory