Language.Haskell.Parser and layout rules

Ross Paterson ross at soi.city.ac.uk
Tue Feb 22 06:23:26 EST 2005


On Tue, Feb 22, 2005 at 11:14:22AM +0000, Malcolm Wallace wrote:
> > > ** A:
> > > g xs = do ys <- workM xs
> > >            if null ys then return [] else do
> > >            zs <- workM ys
> > >            return zs
> 
> I believe nhc98 is correct in parsing this as:
> 
>     g xs = do ys <- workM xs (if null ys then return [] else do
>                                  zs <- workM ys
>                                  return zs)

I don't think so:

exp10 -> ...
      |  if exp then exp else exp
      |  fexp
fexp  -> [fexp] aexp

The argument can't be an if-expression.


More information about the Libraries mailing list