[nhc-bugs] Exporting class methods

Ian Lynagh igloo at earth.li
Fri Apr 15 13:14:17 EDT 2005


On Fri, Apr 15, 2005 at 05:25:36PM +0100, Malcolm Wallace wrote:
> Ian Lynagh <igloo at earth.li> writes:
> 
> > Another nhc bug:
> > 
> > foo :: (Eq (f a), Functor f) => (a -> b) -> f a -> f b -> Bool
> 
> This is documented as one point of non-compliance with H'98 - it is
> the "lifting of the simple context restriction", and cannot be done
> right in nhc98 until it implements kind inference properly.
> 
> > nhc98comp: Couldn't simplify the context (Prelude.Monad (y_19 d_20)).
> > Possible sources for the problem are: 248:35-248:40, 243:24-243:49,
> > 245:42-245:51, 246:35-246:40 and 247:35-247:79
> > 
> > which I assume is related to the above bug.
> 
> It is slightly related.  It indicates a genuine type error, which you
> probably introduced in an attempt to workaround the above bug in nhc98.
> For instance, this should fail:
> 
>     f :: (Monad m, Eq a) => a -> m a -> Bool
>     f x y = (return x == y)
> 
> with the error:
> 
>     Couldn't simplify the context (Prelude.Eq (u_5 t_5))

Ah, the problem turns out to be that the type can't be infered without
the type signature, presumably due to the monomorphism restriction.


Thanks
Ian



More information about the Nhc-bugs mailing list