Why aren't classes like "Num" levity polymorphic?

Clinton Mead clintonmead at gmail.com
Mon May 9 15:26:52 UTC 2022


Hi All

It seems to me to be a free win just to replace:

`class Num a where`

with

`class Num (a :: (r :: RuntimeRep)) where`

And then one could define `Num` instances for unlifted types.

This would make it possible to avoid using the ugly `+#` etc syntax for
operations on unlifted types.

`Int#` and `Word#` could have `Num` instances defined just as `Int` and
`Word` already have.

I presume there's a reason why this hasn't been done, but I was wondering
why?

Thanks,
Clinton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20220510/c2973d3c/attachment.html>


More information about the Glasgow-haskell-users mailing list