Commit a7e3ac4e authored by simonmar's avatar simonmar
Browse files

[project @ 2003-09-11 14:34:24 by simonmar]

Document -fth and -fimplicit-params
parent 25aeb246
......@@ -433,27 +433,27 @@
<tbody>
<row>
<entry><option>-fallow-overlapping-instances</option></entry>
<entry></entry>
<entry>Enable overlapping instances</entry>
<entry>dynamic</entry>
<entry><option>-fno-allow-overlapping-instances</option></entry>
</row>
<row>
<entry><option>-fallow-undecidable-instances</option></entry>
<entry>Enable undecidable instances</entry>
<entry><option>-farrows</option></entry>
<entry>Enable arrow notation extension</entry>
<entry>dynamic</entry>
<entry><option>-fno-allow-undecidable-instances</option></entry>
<entry><option>-fno-arrows</option></entry>
</row>
<row>
<entry><option>-fgenerics</option></entry>
<entry>Enable generics</entry>
<entry><option>-fallow-undecidable-instances</option></entry>
<entry>Enable undecidable instances</entry>
<entry>dynamic</entry>
<entry><option>-fno-fgenerics</option></entry>
<entry><option>-fno-allow-undecidable-instances</option></entry>
</row>
<row>
<entry><option>-fglasgow-exts</option></entry>
<entry>Enable most language extensions</entry>
<entry><option>-fcontext-stack</option><replaceable>n</replaceable></entry>
<entry>set the limit for context reduction</entry>
<entry>dynamic</entry>
<entry><option>-fno-glasgow-exts</option></entry>
<entry><option>-</option></entry>
</row>
<row>
<entry><option>-ffi</option> or <option>-fffi</option></entry>
......@@ -463,16 +463,16 @@
<entry><option>-fno-ffi</option></entry>
</row>
<row>
<entry><option>-farrows</option></entry>
<entry>Enable arrow notation extension</entry>
<entry><option>-fgenerics</option></entry>
<entry>Enable generics</entry>
<entry>dynamic</entry>
<entry><option>-fno-arrows</option></entry>
<entry><option>-fno-fgenerics</option></entry>
</row>
<row>
<entry><option>-fwith</option></entry>
<entry>Enable deprecated <literal>with</literal> keyword</entry>
<entry><option>-fglasgow-exts</option></entry>
<entry>Enable most language extensions</entry>
<entry>dynamic</entry>
<entry><option>-fno-with</option></entry>
<entry><option>-fno-glasgow-exts</option></entry>
</row>
<row>
<entry><option>-fignore-asserts</option></entry>
......@@ -480,6 +480,18 @@
<entry>dynamic</entry>
<entry><option>-fno-ignore-asserts</option></entry>
</row>
<row>
<entry><option>-fimplicit-params</option></entry>
<entry>Enable Implicit Parameters</entry>
<entry>dynamic</entry>
<entry><option>-fno-implicit-params</option></entry>
</row>
<row>
<entry><option>-firrefutable-tuples</option></entry>
<entry>Make tuple pattern matching irrefutable</entry>
<entry>dynamic</entry>
<entry><option>-fno-irrefutable-tuples</option></entry>
</row>
<row>
<entry><option>-fno-implicit-prelude</option></entry>
<entry>Don't implicitly <literal>import Prelude</literal></entry>
......@@ -493,16 +505,16 @@
<entry><option>-</option></entry>
</row>
<row>
<entry><option>-firrefutable-tuples</option></entry>
<entry>Make tuple pattern matching irrefutable</entry>
<entry><option>-fth</option></entry>
<entry>Enable Template Haskell</entry>
<entry>dynamic</entry>
<entry><option>-fno-irrefutable-tuples</option></entry>
<entry><option>-fno-th</option></entry>
</row>
<row>
<entry><option>-fcontext-stack</option><replaceable>n</replaceable></entry>
<entry>set the limit for context reduction</entry>
<entry><option>-fwith</option></entry>
<entry>Enable deprecated <literal>with</literal> keyword</entry>
<entry>dynamic</entry>
<entry><option>-</option></entry>
<entry><option>-fno-with</option></entry>
</row>
</tbody>
</tgroup>
......
......@@ -127,34 +127,51 @@ with GHC.
</listitem>
</varlistentry>
<varlistentry>
<term><option>-fno-implicit-prelude</option></term>
<listitem>
<para><indexterm><primary>-fno-implicit-prelude
option</primary></indexterm> GHC normally imports
<filename>Prelude.hi</filename> files for you. If you'd
rather it didn't, then give it a
<option>-fno-implicit-prelude</option> option. The idea
is that you can then import a Prelude of your own. (But
don't call it <literal>Prelude</literal>; the Haskell
module namespace is flat, and you must not conflict with
any Prelude module.)</para>
<para>Even though you have not imported the Prelude, most of
the built-in syntax still refers to the built-in Haskell
Prelude types and values, as specified by the Haskell
Report. For example, the type <literal>[Int]</literal>
still means <literal>Prelude.[] Int</literal>; tuples
continue to refer to the standard Prelude tuples; the
translation for list comprehensions continues to use
<literal>Prelude.map</literal> etc.</para>
<para>However, <option>-fno-implicit-prelude</option> does
change the handling of certain built-in syntax: see
<xref LinkEnd="rebindable-syntax">.</para>
<varlistentry>
<term><option>-fno-implicit-prelude</option></term>
<listitem>
<para><indexterm><primary>-fno-implicit-prelude
option</primary></indexterm> GHC normally imports
<filename>Prelude.hi</filename> files for you. If you'd
rather it didn't, then give it a
<option>-fno-implicit-prelude</option> option. The idea is
that you can then import a Prelude of your own. (But don't
call it <literal>Prelude</literal>; the Haskell module
namespace is flat, and you must not conflict with any
Prelude module.)</para>
<para>Even though you have not imported the Prelude, most of
the built-in syntax still refers to the built-in Haskell
Prelude types and values, as specified by the Haskell
Report. For example, the type <literal>[Int]</literal>
still means <literal>Prelude.[] Int</literal>; tuples
continue to refer to the standard Prelude tuples; the
translation for list comprehensions continues to use
<literal>Prelude.map</literal> etc.</para>
<para>However, <option>-fno-implicit-prelude</option> does
change the handling of certain built-in syntax: see <xref
LinkEnd="rebindable-syntax">.</para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-fth</option></term>
<listitem>
<para>Enables Template Haskell (see <xref
linkend="template-haskell">). Currently also implied by
<option>-fglasgow-exts</option>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-fimplicit-params</option></term>
<listitem>
<para>Enables implicit parameters (see <xref
linkend="implicit-parameters">). Currently also implied by
<option>-fglasgow-exts</option>.</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
......@@ -1833,7 +1850,13 @@ J Lewis, MB Shields, E Meijer, J Launchbury,
27th ACM Symposium on Principles of Programming Languages (POPL'00),
Boston, Jan 2000.
</para>
<para>(Most of the following, stil rather incomplete, documentation is due to Jeff Lewis.)</para>
<para>(Most of the following, stil rather incomplete, documentation is
due to Jeff Lewis.)</para>
<para>Implicit parameter support is enabled with the option
<option>-fimplicit-params</option>.</para>
<para>
A variable is called <emphasis>dynamically bound</emphasis> when it is bound by the calling
context of a function and <emphasis>statically bound</emphasis> when bound by the callee's
......@@ -3174,10 +3197,16 @@ The documentation here describes the realisation in GHC. (It's rather sketchy j
Tim Sheard is going to expand it.)
</para>
<sect2> <title> Syntax </title>
<para>
Template Haskell has the following new syntactic constructions. You need to use the flag
<literal>-fglasgow-exts</literal> to switch these syntactic extensions on.
<sect2>
<title>Syntax</title>
<para> Template Haskell has the following new syntactic
constructions. You need to use the flag
<option>-fth</option><indexterm><primary><option>-fth</option></primary>
</indexterm>to switch these syntactic extensions on
(<option>-fth</option> is currently implied by
<option>-fglasgow-exts</option>, but you are encouraged to
specify it explicitly).</para>
<itemizedlist>
<listitem><para>
......@@ -3224,7 +3253,6 @@ Tim Sheard is going to expand it.)
</itemizedlist>
</para>
</sect2>
<sect2> <title> Using Template Haskell </title>
......@@ -3310,14 +3338,13 @@ pr :: String -> Expr
pr s = gen (parse s)
</programlisting>
<para>Now run the compiler (here we are using a "stage three" build of GHC, at a Cygwin prompt on Windows):
<para>Now run the compiler (here we are a Cygwin prompt on Windows):
</para>
<programlisting>
ghc/compiler/stage3/ghc-inplace --make -fglasgow-exts -package haskell-src main.hs -o main.exe
$ ghc --make -fth main.hs -o main.exe
</programlisting>
<para>Run "main.exe" and here is your output:
</para>
<para>Run "main.exe" and here is your output:</para>
<programlisting>
$ ./main
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment