| class T root pos sel | pos - root, root - sel where
| f :: pos - sel - Bool
|
| instance T root (Any root) sel where
| f (ANY p) s = f p s
...
| That is not surprising. What is surprising is why GHC 6.6 accepts such
| an instance?
Well, it shouldn't. As the user manual says,
Hallo,
On 3/29/07, Nicolas Frisby [EMAIL PROTECTED] wrote:
A wee bit off topic... but bear with me.
More off-topic... but bear with me. :-)
I'm starting with Haskell. I'm writing a real application with Gtk2hs
and HDBC for a small furniture shop. I have enjoyed it very much so
far, and I
Hi Oleg and others,
[EMAIL PROTECTED] wrote:
Jean-Marie Gaillourdet wrote:
class T root pos sel | pos - root, root - sel where
f :: pos - sel - Bool
instance T root (Any root) sel
If that is correct, I don't understand why this instance should be to
general, as every instantiation of
class T root pos sel | pos - root, root - sel where
f :: pos - sel - Bool
instance T root (Any root) sel
But the same applies to the second functional dependency and the type
variable sel. Every instantiation of root determines the instantiation
of sel. And that forbids instance T Int
A wee bit off topic... but bear with me.
Oleg points out a distinction between declaring a class with
functional dependencies and implementing a class with functional
dependencies. Judging from my experience, it might behoove those
wrestling with type classes and FDs to emphasize that the class
Hi,
[EMAIL PROTECTED] wrote:
The problem is not related to existentials, so we just drop them
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}
module TestCase where
data Any root = ANY
class T root pos sel | pos - root, root - sel where
f :: pos - sel - Bool
instance T
On 3/27/07, Jean-Marie Gaillourdet [EMAIL PROTECTED] wrote:
I concur. The class declares T as being a ternary relation such that
the following holds
forall r p p' s s'. T(r,p,s) T(r,p',s') - s = s'
Now, the instance `T root (Any root) sel' is satisfied when
root=Int, sel = Bool and
Jean-Marie Gaillourdet wrote:
class T root pos sel | pos - root, root - sel where
f :: pos - sel - Bool
instance T root (Any root) sel
If that is correct, I don't understand why this instance should be to
general, as every instantiation of root exactly determines the
corresponding