> > I suspect that the offside rule is acting up. 
> 
> Another offside rule difference I've found is that Hugs will accept
> this code.  (The important thing is that the case alternatives are at
> the same indentation as the case expression.)
>   
>   main = do
>     x <- return Nothing
>     case x of 
>     Nothing -> print x
>     Just y  -> print (y :: Char)
> 
> Whereas ghc rejects it:
> 
>   Foo.hs:4: parse error on input `->'

Again, GHC is correct on this example.  However, I suspect this is one
subtle aspect of layout parsing that will change in Haskell 2.  

A slightly more common example:

        main = do
                x <- something
                seq x $ do
                y <- something else

this is actually illegal, but turned out to be so prevalent in existing code
that I put a special hack into GHC to handle it.  While we cope with this
kind of non-indentation of nested contexts for 'do', we don't handle it for
'case', which is why your example doesn't work with GHC.

Cheers,
        Simon

Reply via email to