Are empty statement lists allowed in recursive do? Possible bug

Alan & Kim Zimmerman alan.zimm at gmail.com
Tue Dec 16 10:51:21 UTC 2014


I am trying to work out empirically whether empty statement lists are
allowed in a stmtlist, and one of the points these are used in Parser.y is
for recursive do.

If I try to load the following

----------------
{-# LANGUAGE RecursiveDo #-}
bar :: IO ()
bar = do
  rec {}
  return ()
-----------------------

into GHCI, I get a "Prelude.head: empty list" panic.

I think this is related to `rnRecStmtsAndThen`

If I try

---------------------
bar :: IO ()
bar = do
  do {}
  return ()
-----------------------

I get a warning about empty do statements not being allowed.

Hence the question as to wether recursive do should be allowed to have an
empty statement list.

I am trying to manage the API annotations for semicolons in statement
lists, and the current way it is being parsed makes this difficult, I would
prefer to simplify it to something like how import decls are parsed, which
can also have multiple semicolons in between.

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20141216/f2f10140/attachment.html>


More information about the ghc-devs mailing list