[bitc-dev] Moose, rugs, and separate compilation
gelfmrogen at yahoo.com
Fri Mar 6 16:16:36 EST 2009
>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.
--- On Fri, 3/6/09, Sandro Magi <naasking at higherlogics.com> wrote:
From: Sandro Magi <naasking at higherlogics.com>
Subject: Re: [bitc-dev] Moose, rugs, and separate compilation
To: "Discussions about the BitC language" <bitc-dev at coyotos.org>
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.
bitc-dev mailing list
bitc-dev at coyotos.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitc-dev