Weird Undecidable Instances Bug

Ashley Yakeley ashley at semantic.org
Tue Sep 9 04:06:41 EDT 2003


On Tuesday, Sep 9, 2003, at 00:40 US/Pacific, Martin Sulzmann wrote:

> Your type annotation
>
> g :: (F a b,D b (T r)) => (a,T r)
> g = f
>
> is simply incorrect.

I must say I don't understand. I need a value of that type. In the 
original, "g" is actually a method in a class, and its definition is in 
an instance declaration. Its type is actually given, not annotated. For 
instance:

-- ghc -fglasgow-exts -fallow-undecidable-instances -c WeirdInsts.hs
module WeirdInsts where
	{
	data T r = MkT;

	class C t;

	class D b t;

	instance (C (T r)) => D b (T r); -- (1)

	class F a b | a -> b;

	f :: (F a b,D b t) => (a,t);
	f = undefined;

	class G t where
		{
		g :: forall a b. (F a b,D b t) => (a,t);
		};

	instance G (T r) where
		{
		g = f;
		};
	}

This exhibits the same behaviour.

-- 
Ashley Yakeley, Seattle WA




More information about the Glasgow-haskell-bugs mailing list