| > In Haskell today, you can at least tell what value is bound to each | > identifier in the program, *without* first doing type checking. | | I'm afraid I'm confused. In the following code | | > data Z | > data S a | > | > class Card c where c2int:: c -> Int | > | > instance Card Z where c2int _ = 0 | > instance (Card c) => Card (S c) where c2int _ = 1 + c2int (undefined::c) | > | > foo = c2int (undefined::(S (S (S (S Z))))) | | how can one tell the value of foo without first doing the | typechecking?
What I meant was that you can always tell what executable code a value is bound to, without type checking. 'foo' is bound to the code for 'c2int (undefined::(S (S (S (S Z)))))'. 'c2int' is bound to code that extracts a method from it's first argument (which is a dictionary for Card). In any higher-order language, a function might invoke one of its arguments f x g = g x but I still say that it's clear what code is executed when f is called! It's true that with type classes the value of one of the dictionary argument is dependent on type checking, which certainly muddies the waters. But at least the type of 'c2int' isn't affected by which method is chosen, which is the real difficulty I was pointing out Simon _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell