Graeme Moss <[EMAIL PROTECTED]> writes:

> Is there anything wrong with the following program?
> 
> > test :: Bool
> > test | True = True
> > test = False
> > 
> > main :: IO ()
> > main = print test
> 
> (Apart from it's apparent uselessness. :-)
> 
> ghc and hbc reject it on grounds of multiple/conflicting definitions,
> but Hugs and nhc accept it.

I think ghc and hbc are correct here.  The two bindings for 'test' are
pattern bindings (according to the syntax from the report), and hence
constitute two separate declarations of the same variable, which is
illegal.  However,

        test | True      = True
             | otherwise = False

is of course fine.

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key


Reply via email to