From: Ian Lynagh Date: Wed, 30 Apr 2008 15:25:08 +0000 (+0000) Subject: Improve the unboxed types documentation X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=cac2c210614b5d71fb82bca16b0bb02e311bb2ff Improve the unboxed types documentation Mainly adding descriptions of unboxed literals, --- diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index f6ca80e..ff32cc2 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -323,11 +323,11 @@ became out of date, and wrong information is worse than none. The Real Truth about what primitive types there are, and what operations work over those types, is held in the file -fptools/ghc/compiler/prelude/primops.txt.pp. +compiler/prelude/primops.txt.pp. This file is used directly to generate GHC's primitive-operation definitions, so it is always correct! It is also intended for processing into text. - Indeed, +Indeed, the result of such processing is part of the description of the External @@ -366,6 +366,20 @@ would use in C: Int# (long int), know and love—usually one instruction. + For some primitive types we have special syntax for literals. +Anything that would be an integer lexeme followed by a +# is an Int# literal, e.g. +32# and -0x3A#. Likewise, +any non-negative integer literal followed by +## is a Word# literal. +Likewise, any floating point literal followed by a +# is a Float# literal, and +followed by ## is a +Double#. Finally, a string literal followed by a +#, e.g. "foo"#, +is a Addr# literal. + + Primitive (unboxed) types cannot be defined in Haskell, and are therefore built into the language and compiler. Primitive types are