[Haskell-cafe] RE: A question about functional dependencies and existential quantification

2007-04-03 Thread Simon Peyton-Jones
| 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,

Re: [Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-29 Thread Alex Queiroz
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

[Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-28 Thread Jean-Marie Gaillourdet
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

[Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-28 Thread oleg
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

Re: [Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-28 Thread Nicolas Frisby
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

[Haskell-cafe] Re: A question about functional dependencies and existential quantification

2007-03-27 Thread Jean-Marie Gaillourdet
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

Re: [Haskell-cafe] Re: A question about functional dependencies and existential quantification

2007-03-27 Thread Felipe Almeida Lessa
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

[Haskell-cafe] Re: A question about functional dependencies and existential

2007-03-27 Thread oleg
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