From 63020bb3aca65e5842e0eb786a81a355b95ef05a Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 25 Feb 2004 13:57:38 +0000 Subject: [PATCH] [project @ 2004-02-25 13:57:38 by simonmar] - For each language option, document exactly the syntax that is stolen from Haskell 98. - Fix up docrot at the beginning of the chapter. --- ghc/docs/users_guide/glasgow_exts.sgml | 85 +++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index baf9ef7..8312aee 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -2,17 +2,19 @@ language, GHC extensions, GHC As with all known Haskell systems, GHC implements some extensions to -the language. To use them, you'll need to give a --fglasgow-exts option option. +the language. They are all enabled by options; by default GHC +understands only plain Haskell 98. -Virtually all of the Glasgow extensions serve to give you access to -the underlying facilities with which we implement Haskell. Thus, you -can get at the Raw Iron, if you are willing to write some non-standard -code at a more primitive level. You need not be “stuck” on -performance because of the implementation costs of Haskell's -“high-level” features—you can always code “under” them. In an extreme case, you can write all your time-critical code in C, and then just glue it together with Haskell! +Some of the Glasgow extensions serve to give you access to the +underlying facilities with which we implement Haskell. Thus, you can +get at the Raw Iron, if you are willing to write some non-portable +code at a more primitive level. You need not be “stuck” +on performance because of the implementation costs of Haskell's +“high-level” features—you can always code +“under” them. In an extreme case, you can write all your +time-critical code in C, and then just glue it together with Haskell! @@ -20,8 +22,8 @@ Before you get too carried away working at the lowest level (e.g., sloshing MutableByteArray#s around your program), you may wish to check if there are libraries that provide a “Haskellised veneer” over the features you want. The -separate libraries documentation describes all the libraries that come -with GHC. +separate libraries +documentation describes all the libraries that come with GHC. @@ -35,10 +37,38 @@ with GHC. extensionsoptions controlling - These flags control what variation of the language are + These flags control what variation of the language are permitted. Leaving out all of them gives you standard Haskell 98. + NB. turning on an option that enables special syntax + might cause working Haskell 98 code to fail + to compile, perhaps because it uses a variable name which has + become a reserved word. So, together with each option below, we + list the special syntax which is enabled by this option. We use + notation and nonterminal names from the Haskell 98 lexical syntax + (see the Haskell 98 Report). There are two classes of special + syntax: + + + + New reserved words and symbols: character sequences + which are no longer available for use as identifiers in the + program. + + + Other special syntax: sequences of characters that have + a different meaning when this particular option is turned + on. + + + + We are only listing syntax changes here that might affect + existing working programs (i.e. "stolen" syntax). Many of these + extensions will also enable new context-free syntax, but in all + cases programs written to use the new syntax would not be + compilable without the option enabled. + @@ -49,6 +79,19 @@ with GHC. Haskell 98 described in , except where otherwise noted. + + New reserved words: forall (only in + types), mdo. + + Other syntax stolen: + varid{#}, + char#, + string#, + integer#, + float#, + float##, + (#, #), + |), {|. @@ -61,6 +104,8 @@ with GHC. Haskell 98 Foreign Function Interface Addendum plus deprecated syntax of previous versions of the FFI for backwards compatibility. + + New reserved words: foreign. @@ -103,6 +148,14 @@ with GHC. See . Independent of . + + New reserved words/symbols: rec, + proc, -<, + >-, -<<, + >>-. + + Other syntax stolen: (|, + |). @@ -149,6 +202,12 @@ with GHC. Enables Template Haskell (see ). Currently also implied by . + + Syntax stolen: [|, + [e|, [p|, + [d|, [t|, + $(, + $varid. @@ -158,6 +217,10 @@ with GHC. Enables implicit parameters (see ). Currently also implied by . + + Syntax stolen: + ?varid, + %varid. -- 1.7.10.4