>typeclass Foo 'a 'b where
>  testFoo: 'a -> 'b -> bool

>let doFoo: 'b -> bool =
>  fun b -> testFoo 3 b


Answer:  No, instance selection should always be done based on the apparent 
types of things, never on the actual types.  In this case, if there isn't an 
instance 
for (testFoo Int a) in scope at the time, it's an error.  If you want 
otherwise, add a
typeclass constraint to doFoo. 

Matt


--- On Fri, 3/6/09, Sandro Magi <[email protected]> wrote:

From: Sandro Magi <[email protected]>
Subject: Re: [bitc-dev] Moose, rugs, and separate compilation
To: "Discussions about the BitC language" <[email protected]>
Date: Friday, March 6, 2009, 9:06 PM

Are you referring to a multi-parameter type class where some type
parameters are unknown? In this case, the instance would need to be
selected from the set of possible choices once the type is supplied.

typeclass Foo 'a 'b where
  testFoo: 'a -> 'b -> bool

let doFoo: 'b -> bool =
  fun b -> testFoo 3 b

Hmm, have to think about that.

Sandro

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev



      
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to