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
|
[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
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
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,
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