Re: [Haskell] Re: indirectly recursive dictionaries

2009-03-19 Thread Martin Sulzmann
On Wed, Mar 18, 2009 at 9:45 AM, Simon Peyton-Jones simo...@microsoft.comwrote: [Redirecting to GHC users.] | Tom Schrijvers wrote: | The cyclic dictionaries approach is a bit fragile. The problem appears to | be here that GHC alternates exhaustive phases of constraint reduction and |

RE: [Haskell] Re: indirectly recursive dictionaries

2009-03-18 Thread Simon Peyton-Jones
[Redirecting to GHC users.] | Tom Schrijvers wrote: | The cyclic dictionaries approach is a bit fragile. The problem appears to | be here that GHC alternates exhaustive phases of constraint reduction and | functional dependency improvement. The problem is that in your example you | need both

[Haskell] Re: indirectly recursive dictionaries

2009-03-17 Thread oleg
Ralf wrote: class C1 x where m1 :: x - () m1 = const undefined instance (C1 x, C1 y) = C1 (x,y) instance C1 Bool instance (C2 x y, C1 (y,Bool)) = C1 x class C2 x y | x - y instance C2 Int Int bar :: () bar = m1 (1::Int) I believe it works very well (meaning bar typechecks and

[Haskell] Re: indirectly recursive dictionaries

2009-03-17 Thread Ralf Laemmel
Re: Tom: Thanks. This was an excellent analysis. Re: Oleg: Obviously, I don't want to add instance C1 int. Rather C1 Int should be implied by the existing scheme for recursive dictionary construction and bar should typecheck fine. (foo already relies on this scheme.) However, as Tom pointed out,

[Haskell] Re: indirectly recursive dictionaries

2009-03-17 Thread oleg
Tom Schrijvers wrote: The cyclic dictionaries approach is a bit fragile. The problem appears to be here that GHC alternates exhaustive phases of constraint reduction and functional dependency improvement. The problem is that in your example you need both for detecting a cycle. It seems we