[m-dev.] type classes and the color blue
Michael Day
mcda at cat.cs.mu.OZ.AU
Fri Jan 14 21:23:34 AEDT 2000
> I think you mean `is_blue/0' in both instances.
Correct, a lamentable one-bit error.
> Anyhow, your typeclass declaration looks mighty suspect. The fact that the
> type of the method is_blue/0 does not mention the type variable `T' is the
> worry.
Right again, I'm stuck in the foolish mentality of one expecting an
implicit "self" pointer and associated type information with every method
call.
So really I do want:
:- typeclass thing(T) where
[
pred is_blue(T),
mode is_blue(in) is semidet
].
even if is_blue never actually examines its argument explicitly, it
requires the argument to get the typeclass_info to know which is_blue to
call. Or something along those lines, albeit better phrased.
Will Mercury face opposition from people who have dedicated the last
decade of their lives to getting used to data->code() rather than
code(data) ? A discriminated union full of closures just isn't the same...
Michael
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list