On 2001-08-13T18:08:08-0400, Avi Pfeffer wrote:
> Inferring equality between types when there are functional dependencies
> seems to be less powerful than I expected. Here's a simple example:
>
> class Eq b => C a b | a -> b
>
> data T a = forall b . C a b => T b
> data U a = forall b . C a b => U b
>
> compare :: T a -> U a -> Bool
> compare (T x) (U y) = x == y
Hrm, is it possible for you to define instead
data T a b = C a b => T a b
data U a b = C a b => U a b
and propagate the dependency inference of "a -> b" upward in your
program? Or even simply say
data T a b = T a b
data U a b = U a b
and put the C constraint further higher up in your program? Just a
thought...
--
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
I saw my inner child once, on a milk carton.
PGP signature