[Haskell-cafe] unboxed types in classes

Max Bolingbroke batterseapower at hotmail.com
Wed Apr 14 03:45:06 EDT 2010


Hi Phyx,

> instance Foo Int# Int where
>      bar = iBox

What you want is not currently possible, for many of the same reasons
that you cannot instantiate polymorphic types (e.g. that of id) at
unboxed types. Because you can't then be polymorphic in the "a" in
"Foo a b" if a might be an unboxed type, writing such a type class
would be slightly less useful than normal - you would get name
overloading, but not the ability to abstract over the type class in a
meaningful way.

Cheers,
Max


More information about the Haskell-Cafe mailing list