[Haskell] Re: Boxing (Day) Question

Bulat Ziganshin bulatz at HotPOP.com
Wed Dec 28 06:56:06 EST 2005

Hello Ashley,

Tuesday, December 27, 2005, 2:46:11 AM, you wrote:

>> it's unserious :)  overloading of unboxed types must be resolved at
>> compile time, as in C++ templates.

Why can't (->>) that's been specialised to #4 -> #4 -> * just generate a 
AY> function that takes an anonymous 4-byte quantity and returns an 
AY> anonymous 4-byte quantity?

for why?

AY>   class C (x :: #4) where ...

AY>   foo :: (C x) => x -> Bool
AY>   foo x = ...

AY> might be generate something like this:

AY>   HsBool foo (CDict dict,int32 x) { ... }

yes, it can be implemented in such way. but i don't see any
interesting usage for this compile+run-time overloading resolution

mandatory compile-time overloading have many much benefits, because it
allows to inline used procedures and futher optimize code. something
like this is done in jhc

C++ just supports both types of overloading through a different synax
forms (templates and virtual methods). i'm interested in having option
to force Haskell compiler use compile-time overloading and fail
compilation if that is impossible for some reason; but at the same
time use the same syntax forms for both overloading types

adding facility to specify strictness of arguments and function result
can help compiler to decide whether arguments/result can be unboxed

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell mailing list