Skip to content

improve documentation of unboxed types

Summary

Location of documentation issue: (e.g. the Haddocks of base, the GHC user's guide) GHC users guide

Write a brief description of the issue. Hard time figuring out how to use unboxed values

Proposed improvements or changes

Feel free to propose changes, either concrete or abstract.

https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#glasgow-unboxed points to GHC.Prim docs as the detailed documentation of this feature, but 1) the link 404's, and 2) after fixing the link (it has extra text that shouldn't be there), the GHC.Prim docs don't make it clear how to translate unboxed values to and from boxed ones. The answer is that you have to import GHC.Exts. That gives you data constructors like I# which you can use to convert between boxed and unboxed values, by construction or pattern matching. The docs should mention that, maybe with an example.

Environment

  • GHC version used (if appropriate): 9.1 docs
Edited by solrize
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information