Andy Gill writes:
> 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 `->'

until you indent the case alternatives:
  
  main = do
    x <- return Nothing
    case x of 
     Nothing -> print x
     Just y  -> print (y :: Char)
  
I'm not sure which is right and am more troubled by the difference than
by any particular choice.

I slightly prefer Hugs' behaviour because it's consistent with the
handling of this code:
  
  foo x = 
    case x of 
    Nothing -> print x
    Just y  -> print (y :: Char)

which is accepted by both GHC and Hugs.


--
Alastair

Reply via email to