MPTCs and functional dependencies

Ross Paterson ross at soi.city.ac.uk
Tue Feb 7 08:47:21 EST 2006


On Tue, Feb 07, 2006 at 10:04:35AM +0100, Georg Martius wrote:
> From the users point of view, the implementation in GHC works quite
> well and a lot people use it. It would be a pity if they are not
> included in the new standard.  What is the problem of specifying what
> is implemented.

They work well most of the time, but people keep discovering strange
behaviour around the edges.  For example, the following (example 6 of
Sulzmann et al) sends GHC into a loop:

	class Mul a b c | a b -> c where
		(.*.) :: a -> b -> c

	instance Mul Int Int Int where (.*.) = (*)
	instance Mul Int Float Float where x .*. y = fromIntegral x * y
	instance Mul a b c => Mul a [b] [c] where x .*. v = map (x.*.) v

	f = \ b x y -> if b then x .*. [y] else y

Noone knows how to specify them (short of pointing at GHC, which won't do).
The closest is Sulzmann et al, which makes the problems clearer.



More information about the Haskell-prime mailing list