Skip to content

replace Int with Word where it makes sense

There was a discussion about replacing Int with Word where that makes sense. I was asked to record the idea (https://mail.haskell.org/pipermail/haskell-cafe/2021-March/133520.html). (I don't feel qualified to evaluate the effect on GHC. I was asking from a user's/teacher's perspective.) Sylvain's proposal is:

  • One first step would be to use Word# instead of Int# in ghc primops where it makes sense. This could be done as it should be transparent to most users.

  • The natural next step would be to modify functions and classes in base to use appropriate types too. I don't think it's going to happen as it would require modifying the Haskell report and breaking almost every existing code/books/etc.

  • So an alternative path would be to extract every wired-in things from base and to put them into a ghc-base package that base, foundation and other alternative preludes would depend on. This way we could write codes that don't depend on base and the legacy stuff it contains at all (even transitively).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information