Inferred type too general, ignoring functional dependencies
Consider
module FloatFDs2 where
class C a b | a -> b where
meth :: a -> b -> ()
data Ex where
MkEx :: a -> Ex
f x = (\y -> case x of MkEx _ -> meth x y, \z -> case x of MkEx _ -> meth x z)
GHC infers f :: forall p1 p2. (C Ex p1, C Ex p2) => Ex -> (p1 -> (), p2 -> ())
. That's silly: p1
and p2
should have been unified.
Solution is on the way in a branch I'm working on about a constraint solver refactor.