RE: [Haskell-cafe] Closed Classes

add the extra rule that if there is only one possible instance the compiler should use it.
Yes, I think that is what I am saying. The closed class assumption alters the types of exported functions by applying improvements to them - that is not what I meant at all. I think what is confusing me is the 'possible' part. I was thinking about applying type improvement to effectively determine which instance to choose. (I think this is an error on my part - I get the impression type improvement cannot be used for this) ... would a possibel instance be something like: assuming you are resolving instances lazily at the last possible moment, you try to unify all instances and if one and only one unifies - use that instance. Keean.

But that would break existing programs. You would need a language extension so the feature could be selectively enabled.
Yes. Which means I think that you cannot support a closed world, as given by that simple defining rule, without a language extension. The root of the question seems to be what "closed world" means with "when resolving instances" / "at the last possible moment" (if it it was "at the last stage at global level in a compilation unit" then "g" would have type Int->Int). In my view without that simple defining rule it is difficult to come up with a proposal that is simple, sound and gives principal typings (well, with it is already difficult...:-). Cheers, Carlos
participants (2)
-
Carlos Camarão
-
MR K P SCHUPKE