GHC bug,or Hugs feature?

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 7 Aug 2002 14:52:46 +0100


Arthur Baars <arthurb@cs.uu.nl> writes:

> f   :: Eq a => a -> Bool
> f x = x==x || g True
> g y = y<=y || f True
> 
> According to the paper the inferred type of g should be:
>   g::Ord a => a -> Bool
> 
> Hugs infers this type but GHC infers the following *ambiguous* type:
>   g :: forall a. (Eq a) => Bool -> Bool

nhc98 infers the type
    g :: Bool -> Bool

> When adding an explicit type signature for g, Hugs happily accepts the
> code, but GHC gives an error:

nhc98, like Hugs, accepts the explicit (more general) type signature:
    g :: Ord a => a -> Bool
without complaint.

Regards,
    Malcolm