| I believe something along the lines of the following would work:
| 
| > class C a b | a -> b where { foo :: b -> String }
| > instance C Int Int   where { foo x = show (x+1) }
| > x :: forall b. C Int b => b
| > x = 5
| 
| (Supposing that the above definition were valid; i.e., we didn't get
the
| type signature error, this reads that x has type "b" for all types
| "b" such that C Int b -- the fact that there is only one such type
(due to
| the fun dep) is for us to know.)
| 
| Then, we should be able to say:
| 
| > foo x
| 
| and get "6".

I understand that is what you would like, but I do not know how to
achieve it in a reasonable way.  (By "reasonable" I mean both in terms
of a reasonably simple type inference algorithm, and in terms of a
reasonable translation into a typed intermediate language.  The latter
is, in a sense, just an implementation matter, but I have found it to be
an excellent sanity check.)

Simon

| 

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to