Functional dependencies

Jeffrey R Lewis jeff@galconn.com
Thu, 6 Dec 2001 12:16:32 -0800


On Friday 30 November 2001 03:03 am, Josef Svenningsson wrote:
> Hi!
>
> It seems as the functional dependencies are not working as well as they
> should.
>
> Suppose I have the following class:
>
> \begin{code}
> class A a b | a -> b where
>   foo :: a b
> \end{code}
>
> and then I declare the following type:
>
> \begin{code}
> newtype Foo = Bar (forall a b. A a b => a Int)
> \end{code}
>
> Loading this in hugs gives the following error message:
> ERROR HugsBug.lhs:9 - Ambiguous type signature in type component
> *** ambiguous type : A a b => a Int
>
> But the type is clearly not ambiguous since the functional dependency
> determines b whenever a is known.
>

Hugs is a bit overly aggressive there about warning of potential ambiguity. 
This is fixed in the upcoming release.

--Jeff