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
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to