diff options
-rw-r--r-- | docs/users_guide/glasgow_exts.xml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index f6ca80ee87..ff32cc2946 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.</para> <para>The Real Truth about what primitive types there are, and what operations work over those types, is held in the file -<filename>fptools/ghc/compiler/prelude/primops.txt.pp</filename>. +<filename>compiler/prelude/primops.txt.pp</filename>. 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.</para> -<para> Indeed, +<para>Indeed, the result of such processing is part of the description of the <ulink url="http://www.haskell.org/ghc/docs/papers/core.ps.gz">External @@ -366,6 +366,20 @@ would use in C: <literal>Int#</literal> (long int), know and love—usually one instruction. </para> +<para> For some primitive types we have special syntax for literals. +Anything that would be an integer lexeme followed by a +<literal>#</literal> is an <literal>Int#</literal> literal, e.g. +<literal>32#</literal> and <literal>-0x3A#</literal>. Likewise, +any non-negative integer literal followed by +<literal>##</literal> is a <literal>Word#</literal> literal. +Likewise, any floating point literal followed by a +<literal>#</literal> is a <literal>Float#</literal> literal, and +followed by <literal>##</literal> is a +<literal>Double#</literal>. Finally, a string literal followed by a +<literal>#</literal>, e.g. <literal>"foo"#</literal>, +is a <literal>Addr#</literal> literal. +</para> + <para> Primitive (unboxed) types cannot be defined in Haskell, and are therefore built into the language and compiler. Primitive types are |