I ran into a simple falure with functional dependencies (in GHC 7.4.1):

> class Foo a ta | a -> ta
>
> foo :: (Foo a ta, Foo a tb, Eq ta) => ta -> tb -> Bool
> foo = (==)

I expected that the `a -> ta` functional dependency would suffice to prove
that `ta ~ tb`, but

    Pixie/Bug1.hs:9:7:
        Could not deduce (ta ~ tb)
        from the context (Foo a ta, Foo a tb, Eq ta)
          bound by the type signature for
                     foo :: (Foo a ta, Foo a tb, Eq ta) => ta -> tb -> Bool
          at Pixie/Bug1.hs:9:1-10
          `ta' is a rigid type variable bound by
               the type signature for
                 foo :: (Foo a ta, Foo a tb, Eq ta) => ta -> tb -> Bool
               at Pixie/Bug1.hs:9:1
          `tb' is a rigid type variable bound by
               the type signature for
                 foo :: (Foo a ta, Foo a tb, Eq ta) => ta -> tb -> Bool
               at Pixie/Bug1.hs:9:1
        Expected type: ta -> tb -> Bool
          Actual type: ta -> ta -> Bool
        In the expression: (==)
        In an equation for `foo': foo = (==)
    Failed, modules loaded: none.

Any insights about what's going wrong here?

-- Conal
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to