Empty modules

Reid Barton rwbarton at gmail.com
Thu Sep 20 20:14:04 CEST 2012

Just a minor inconsistency in the Haskell 2010 report I happened to
notice.  The BNF in Section 5.1 disallows an empty module

    module X where {}

while the following prose suggests that both the list of import
declarations and the list of top-level declarations may be empty.  GHC
does accept such an empty module and I assume the intent of the Report
is that an empty module should be allowed.

The Report could be fixed by
1. adding an alternative "{ }" production for body
2. replacing the bounds on n in impdecls and topdecls by "n >= 0" to
match the prose. Then the empty module would match both the second and
third alternatives for body but I do not think this is a concern.

Reid Barton

More information about the Haskell-prime mailing list