[Haskell] Re: Boxing (Day) Question

Ashley Yakeley ashley at semantic.org
Mon Dec 26 18:46:11 EST 2005


In article <155148271993.20051226161427 at HotPOP.com>,
 Bulat Ziganshin <bulatz at HotPOP.com> 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 
function that takes an anonymous 4-byte quantity and returns an 
anonymous 4-byte quantity?

> Haskell polymorhism, based on using
> of type classes, oriented to run-time resolving of polymorphic usage,
> although SPECIALIZE/INLINE/RULES pragmas can optimize code, the
> program must remain correct without these pragmas and therefore
> overloading is limited to boxed types. aside of different sizes, boxed
> values carry dictionaries used to run-time resolving of overloaded
> functions. where unboxed value must hide this dictionary? :)

I thought functions receive dictionaries, rather than dictionaries being 
stored inside values? For instance:

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

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

might be generate something like this:

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

> but i'm totally agree that we must have C++-like compile-time
> overloading in order to create fast programs

-- 
Ashley Yakeley, Seattle WA



More information about the Haskell mailing list