[bitc-dev] Moose, rugs, and separate compilation
Jonathan S. Shapiro
shap at eros-os.com
Fri Mar 6 17:38:20 EST 2009
On Fri, Mar 6, 2009 at 5:11 PM, Gelf Mrogen <gelfmrogen at yahoo.com> wrote:
> --- On Fri, 3/6/09, Jonathan S. Shapiro <shap at eros-os.com> wrote:
>
>> Problem: These two instance resolutions occur in different contexts,
>> and it is entirely possible that we will end up with two DISTINCT
>> instance resolutions.
>
>
> Why is this a problem? When we were writing function g, the types 'a and
> char
> never unified precisely because we had no need for them to be the same.
That's just my first example. With multi-variable type classes you can
have one variable resolved in one lexical context and the other in
another lexical context. Which lexical context is definitive?
Extending the previous example, consider a type class:
(TwoTypes 'a 'b)
requiring that (Eq 'a) and (Ord 'b). Now suppose that 'a is resolved
in one place and 'b is resolved in another. It's clear that TwoTypes
isn't resolvable until both variables are resolvable. Since the
requirement (Eq 'a) is a logical consequence of (TwoTypes 'a 'b), a
case can be made that the (Eq 'a) requirement should not be
"recognized" until (TwoTypes 'a 'b) is resolved.
shap
More information about the bitc-dev
mailing list