summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/7.10.1-notes.xml376
-rw-r--r--docs/users_guide/7.8.1-notes.xml1251
-rw-r--r--docs/users_guide/codegens.xml2
-rw-r--r--docs/users_guide/external_core.xml1804
-rw-r--r--docs/users_guide/flags.xml566
-rw-r--r--docs/users_guide/ghci.xml86
-rw-r--r--docs/users_guide/glasgow_exts.xml526
-rw-r--r--docs/users_guide/gone_wrong.xml4
-rw-r--r--docs/users_guide/phases.xml18
-rw-r--r--docs/users_guide/ug-book.xml.in1
-rw-r--r--docs/users_guide/ug-ent.xml.in3
-rw-r--r--docs/users_guide/using.xml130
12 files changed, 1147 insertions, 3620 deletions
diff --git a/docs/users_guide/7.10.1-notes.xml b/docs/users_guide/7.10.1-notes.xml
new file mode 100644
index 0000000000..6d9b9378a1
--- /dev/null
+++ b/docs/users_guide/7.10.1-notes.xml
@@ -0,0 +1,376 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<sect1 id="release-7-10-1">
+ <title>Release notes for version 7.10.1</title>
+
+ <para>
+ The significant changes to the various parts of the compiler are listed
+ in the following sections. There have also been numerous bug fixes and
+ performance improvements over the 7.8 branch.
+ </para>
+
+ <sect2>
+ <title>Highlights</title>
+
+ <para>
+ The highlights, since the 7.8 branch, are:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+
+ <sect2>
+ <title>Full details</title>
+ <sect3>
+ <title>Language</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Added support for <link linkend="binary-literals">binary integer literals</link>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Compiler</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ GHC now checks that all the language extensions required for
+ the inferred type signatures are explicitly enabled. This
+ means that if any of the type signatures inferred in your
+ program requires some language extension you will need to
+ enable it. The motivation is that adding a missing type
+ signature inferred by GHC should yield a program that
+ typechecks. Previously this was not the case.
+ </para>
+ <para>
+ This is a breaking change. Code that used to compile in the
+ past might fail with an error message requiring some
+ particular language extension (most likely
+ <option>-XTypeFamilies</option>, <option>-XGADTs</option> or
+ <option>-XFlexibleContexts</option>).
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>GHCi</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Template Haskell</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Runtime system</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Build system</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+ </sect2>
+
+ <sect2>
+ <title>Libraries</title>
+
+ <sect3>
+ <title>array</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.5.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>base</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 4.7.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>bin-package-db</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ This is an internal package, and should not be used.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>binary</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.7.1.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>bytestring</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.10.4.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Cabal</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.18.1.3)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>containers</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.5.4.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>deepseq</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.3.0.2)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>directory</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.2.0.2)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>filepath</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.3.0.2)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>ghc-prim</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.3.1.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>haskell98</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 2.0.0.3)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>haskell2010</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.1.1.1)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>hoopl</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 3.10.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>hpc</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.6.0.1)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>integer-gmp</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 0.5.1.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>old-locale</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.0.0.6)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>old-time</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.1.0.2)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>process</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.2.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>template-haskell</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 2.9.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>time</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 1.4.1)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>unix</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 2.7.0.0)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+
+ <sect3>
+ <title>Win32</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Version number XXXXX (was 2.3.0.1)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect3>
+ </sect2>
+
+ <sect2>
+ <title>Known bugs</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ TODO FIXME
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+</sect1>
diff --git a/docs/users_guide/7.8.1-notes.xml b/docs/users_guide/7.8.1-notes.xml
deleted file mode 100644
index 36b0ad52a7..0000000000
--- a/docs/users_guide/7.8.1-notes.xml
+++ /dev/null
@@ -1,1251 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<sect1 id="release-7-8-1">
- <title>Release notes for version 7.8.1</title>
-
- <para>
- The significant changes to the various parts of the compiler are listed
- in the following sections. There have also been numerous bug fixes and
- performance improvements over the 7.6 branch.
- </para>
-
- <sect2>
- <title>Highlights</title>
-
- <para>
- The highlights, since the 7.6 branch, are:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- OS X Mavericks with XCode 5 is now properly supported
- by GHC. As a result of this, GHC now uses Clang to
- preprocess Haskell code by default for Mavericks
- builds.
- </para>
-
- <para>
- Note that normally, GHC used <literal>gcc</literal> as
- the preprocessor for Haskell code (as it was the
- default everywhere,) which implements
- <literal>-traditional</literal> behavior. However,
- Clang is not 100% compatible with GCC's
- <literal>-traditional</literal> as it is rather
- implementation specified and does not match any
- specification. Clang is also more strict.
- </para>
-
- <para>
- As a result of this, when using Clang as the
- preprocessor, some programs which previously used
- <literal>-XCPP</literal> and the preprocessor will now
- fail to compile. Users who wish to retain the previous
- behavior are better off using cpphs as an external
- preprocessor for the time being.
- </para>
-
- <para>
- In the future, we hope to fix this by adopting a
- better preprocessor implementation independent of the
- C compiler (perhaps cpphs itself,) and ship that
- instead.
- </para>
- </listitem>
-
- <listitem>
- <para>
- By default, GHC has a new warning enabled,
- <literal>-fwarn-typed-holes</literal>, which causes the
- compiler to respond with the types of unbound
- variables it encounters in the source code. (It is
- reminiscient of the "holes" feature in languages such
- as Agda.)
-
- For more information, see <xref linkend="typed-holes"/>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC can now perform simple evaluation of type-level
- natural numbers, when using the
- <literal>DataKinds</literal> extension. For example,
- given a type-level constraint such as <literal>(x + 3)
- ~ 5</literal>, GHC is able to infer that
- <literal>x</literal> is 2. Similarly, GHC can now
- understand type-level identities such as <literal>x +
- 0 ~ x</literal>.
- </para>
-
- <para>
- Note that the solving of these equations is only used
- to resolve unification variables - it does not
- generate new facts in the type checker. This is
- similar to how functional dependencies work.
- </para>
- </listitem>
-
- <listitem>
- <para>
- It is now possible to declare a 'closed' <literal>type
- family</literal> when using the
- <literal>TypeFamilies</literal> extension. A closed
- <literal>type family</literal> cannot have any
- instances created other than the ones in its
- definition.
-
- For more information, see <xref linkend="closed-type-families"/>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Use of the <literal>GeneralizedNewtypeDeriving</literal>
- extension is now subject to <emphasis>role checking</emphasis>,
- to ensure type safety of the derived instances. As this change
- increases the type safety of GHC, it is possible that some code
- that previously compiled will no longer work.
-
- For more information, see <xref linkend="roles"/>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now supports overloading list literals using the new
- <literal>OverloadedLists</literal> extension.
-
- For more information, see <xref linkend="overloaded-lists"/>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now supports pattern synonyms, enabled by the
- <literal>-XPatternSynonyms</literal> extension,
- allowing you to name and abstract over patterns more
- easily.
-
- For more information, see <xref linkend="pattern-synonyms"/>.
- </para>
- <para>
- Note: For the GHC 7.8.1 version, this language feature
- should be regarded as a preview.
- </para>
- </listitem>
-
- <listitem>
- <para>
- There has been significant overhaul of the type
- inference engine and constraint solver, meaning it
- should be faster and use less memory.
- </para>
- </listitem>
-
- <listitem>
- <para>
- By default, GHC will now unbox all "small" strict
- fields in a data type. A "small" data type is one
- whose size is equivalent to or smaller than the native
- word size of the machine. This means you no longer
- have to specify <literal>UNPACK</literal> pragmas for
- e.g. strict <literal>Int</literal> fields. This also
- applies to floating-point values.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now has a brand-new I/O manager that scales significantly
- better for larger workloads compared to the previous one. It
- should scale linearly up to approximately 32 cores.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The LLVM backend now supports 128- and 256-bit SIMD
- operations.
- </para>
- <para>
- Note carefully: this is <emphasis>only</emphasis> available with
- the LLVM backend, and should be considered
- experimental.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The new code generator, after significant work by many
- individuals over the past several years, is now enabled by
- default. This is a complete rewrite of the STG to Cmm
- transformation. In general, your programs may get slightly
- faster.
- </para>
-
- <para>
- The old code generator has been removed completely.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now has substantially better support for cross
- compilation. In particular, GHC now has all the
- necessary patches to support cross compilation to
- Apple iOS, using the LLVM backend.
- </para>
- </listitem>
-
- <listitem>
- <para>
- PrimOps for comparing unboxed values now return
- <literal>Int#</literal> instead of <literal>Bool</literal>.
- This change is backwards incompatible. See
- <ulink url="http://ghc.haskell.org/trac/ghc/wiki/NewPrimopsInGHC7.8">
- this GHC wiki page</ulink> for instructions how to update your
- existing code. See <ulink url="http://ghc.haskell.org/trac/ghc/wiki/PrimBool">
- here</ulink> for motivation and discussion of implementation details.
- </para>
- </listitem>
-
- <listitem>
- <para>
- New PrimOps for atomic memory operations.
- The <literal>casMutVar#</literal> PrimOp was introduced in
- GHC 7.2 (debugged in 7.4). This release also includes additional
- PrimOps for compare-and-swap (<literal>casArray#</literal> and
- <literal>casIntArray#</literal>) and one for fetch-and-add
- (<literal>fetchAddIntArray#</literal>).
- </para>
- </listitem>
-
- <listitem>
- <para>
- On Linux, FreeBSD and Mac OS X, GHCi now uses the
- system dynamic linker by default, instead of its built
- in (static) object linker. This is more robust
- cross-platform, and fixes many long-standing bugs (for
- example: constructors and destructors, weak symbols,
- etc work correctly, and several edge cases in the RTS
- are fixed.)
- </para>
-
- <para>
- As a result of this, GHCi (and Template Haskell) must
- now load <emphasis>dynamic</emphasis> object files, not static
- ones. To assist this, there is a new compilation flag,
- <literal>-dynamic-too</literal>, which when used
- during compilation causes GHC to emit both static and
- dynamic object files at the same time. GHC itself
- still defaults to static linking.
- </para>
-
- <para>
- Note that Cabal will correctly handle
- <literal>-dynamic-too</literal> for you automatically,
- especially when <literal>-XTemplateHaskell</literal>
- is needed - but you <emphasis>must</emphasis> tell Cabal you are
- using the <literal>TemplateHaskell</literal>
- extension.
- </para>
-
- <para>
- Note that you must be using Cabal and Cabal-install
- 1.18 for it to correctly build dynamic shared libraries
- for you.
- </para>
-
- <para>
- Currently, Dynamic GHCi and
- <literal>-dynamic-too</literal> are not supported on
- Windows (32bit or 64bit.)
- </para>
- </listitem>
-
- <listitem>
- <para>
- <literal>Typeable</literal> is now poly-kinded, making
- <literal>Typeable1</literal>, <literal>Typeable2</literal>,
- etc., obsolete, deprecated, and relegated to
- <literal>Data.OldTypeable</literal>. Furthermore, user-written
- instances of <literal>Typeable</literal> are now disallowed:
- use <literal>deriving</literal> or the new extension
- <literal>-XAutoDeriveTypeable</literal>, which will create
- <literal>Typeable</literal> instances for every datatype
- declared in the module.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now has a parallel compilation driver. When
- compiling with <literal>--make</literal> (which is on
- by default,) you may also specify
- <literal>-jN</literal> in order to compile
- <replaceable>N</replaceable> modules in
- parallel. (Note: this will automatically scale on
- multicore machines without specifying <literal>+RTS
- -N</literal> to the compiler.)
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC now has support for a new pragma,
- <literal>{-# MINIMAL #-}</literal>, allowing you to
- explicitly declare the minimal complete definition of
- a class. Should an instance not provide the minimal
- required definitions, a warning will be emitted.
- See <xref linkend="minimal-pragma"/> for details.
- </para>
- </listitem>
-
- <listitem>
- <para>
- In GHC 7.10, <literal>Applicative</literal> will
- become a superclass of <literal>Monad</literal>,
- potentially breaking a lot of user code. To ease this
- transition, GHC now generates warnings when
- definitions conflict with the Applicative-Monad
- Proposal (AMP).
- </para>
-
- <para>
- A warning is emitted if a type is an instance of
- <literal>Monad</literal> but not of
- <literal>Applicative</literal>,
- <literal>MonadPlus</literal> but not
- <literal>Alternative</literal>, and when a local
- function named <literal>join</literal>,
- <literal>&lt;*&gt;</literal> or <literal>pure</literal> is
- defined.
- </para>
-
- <para>
- The warnings are enabled by default, and can be controlled
- using the new flag <literal>-f[no-]warn-amp</literal>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Using the new <literal>InterruptibleFFI</literal>
- extension, it's possible to now declare a foreign
- import as <literal>interruptible</literal>, as opposed
- to only <literal>safe</literal> or
- <literal>unsafe</literal>. An
- <literal>interruptible</literal> foreign call is the
- same as a <literal>safe</literal> call, but may be
- interrupted by asynchronous <emphasis>Haskell
- exceptions</emphasis>, such as those generated by
- <literal>throwTo</literal> or
- <literal>timeout</literal>.
- </para>
-
- <para>
- For more information (including the exact details on
- how the foreign thread is interrupted,) see <xref
- linkend="ffi-interruptible"/>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- GHC's internal compiler pipeline is now exposed
- through a <literal>Hooks</literal> module inside the
- GHC API. These hooks allow you to control most of the
- internal compiler phase machinery, including compiling
- expressions, phase control, and linking.
- </para>
-
- <para>
- Note: this interface will likely see continuous
- refinement and API changes in future releases, so it
- should be considered a preview.
- </para>
- </listitem>
- <listitem>
- <para>
- The LLVM code generator has been fixed to support
- dynamic linking. This enables runtime-linking
- (e.g. GHCi) support for architectures without support in
- GHC's own runtime linker (e.g. ARM).
- </para>
- <para>
- Note: Tables-next-to-code is disabled when building on
- ARM with binutil's ld due to a
- <ulink url="https://sourceware.org/bugzilla/show_bug.cgi?id=16177">
- bug</ulink> in ld.
- </para>
- </listitem>
- </itemizedlist>
- </sect2>
-
- <sect2>
- <title>Full details</title>
- <sect3>
- <title>Language</title>
- <itemizedlist>
- <listitem>
- <para>
- There is a new extension,
- <literal>NullaryTypeClasses</literal>, which
- allows you to declare a type class without any
- parameters.
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- There is a new extension,
- <literal>NumDecimals</literal>, which allows you
- to specify an integer using compact "floating
- literal" syntax. This lets you say things like
- <literal>1.2e6 :: Integer</literal> instead of
- <literal>1200000</literal>
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- There is a new extension,
- <literal>NegativeLiterals</literal>, which will
- cause GHC to interpret the expression
- <literal>-123</literal> as <literal>fromIntegral
- (-123)</literal>. Haskell 98 and Haskell 2010 both
- specify that it should instead desugar to
- <literal>negate (fromIntegral 123)</literal>
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- There is a new extension,
- <literal>EmptyCase</literal>, which allows
- to write a case expression with no alternatives
- <literal>case ... of {}</literal>.
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- The <literal>IncoherentInstances</literal>
- extension has seen a behavioral change, and is
- now 'liberated' and less conservative during
- instance resolution. This allows more programs to
- compile than before.
- </para>
- <para>
- Now, <literal>IncoherentInstances</literal> will
- always pick an arbitrary matching instance, if
- multiple ones exist.
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- A new built-in function <literal>coerce</literal> is
- provided that allows to safely coerce values between types
- that have the same run-time-presentation, such as
- newtypes, but also newtypes inside containers. See the
- haddock documentation of
- <ulink url="&libraryBaseLocation;/Data-Coerce.html#v%3Acoerce">coerce</ulink>
- and of the class
- <ulink url="&libraryBaseLocation;/Data-Coerce.html#t%3ACoercible">Coercible</ulink>
- for more details.
- </para>
- <para>
- This feature is included in this release as a technology
- preview, and may change its syntax and/or semantics in the
- next release.
- </para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>
- The new pragma, <literal>{-# MINIMAL #-}</literal>,
- allows to explicitly declare the minimal complete
- definition of a class. Should an instance not provide
- the minimal required definitions, a warning will be
- emitted.
- </para>
-
- <para>
- See <xref linkend="minimal-pragma"/> for more details.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Compiler</title>
- <itemizedlist>
- <listitem>
- <para>
- GHC can now build both static and dynamic object
- files at the same time in a single compilation
- pass, when given the
- <literal>-dynamic-too</literal> flag. This will
- produce both a statically-linkable
- <literal>.o</literal> object file, and a
- dynamically-linkable <literal>.dyn_o</literal>
- file. The output suffix of the dynamic objects can
- be controlled by the flag
- <literal>-dynosuf</literal>.
- </para>
-
- <para>
- Note that GHC still builds statically by default.
- </para>
- </listitem>
- <listitem>
- <para>
- GHC now supports a
- <literal>--show-options</literal> flag, which will
- dump all of the flags it supports to standard out.
- </para>
- </listitem>
- <listitem>
- <para>
- GHC now supports warning about overflow of integer
- literals, enabled by
- <literal>-fwarn-overflowed-literals</literal>. It
- is enabled by default.
- </para>
- </listitem>
- <listitem>
- <para>
- It's now possible to switch the system linker on Linux
- (between GNU gold and GNU ld) at runtime without problem.
- </para>
- </listitem>
- <listitem>
- <para>
- The <literal>-fwarn-dodgy-imports</literal> flag now warns
- in the case an <literal>import</literal> statement hides an
- entity which is not exported.
- </para>
- </listitem>
- <listitem>
- <para>
- The LLVM backend was overhauled and rewritten, and
- should hopefully be easier to maintain and work on
- in the future.
- </para>
- </listitem>
- <listitem>
- <para>
- GHC now detects annotation changes during
- recompilation, and correctly persists new
- annotations.
- </para>
- </listitem>
- <listitem>
- <para>
- There is a new set of primops for utilizing
- hardware-based prefetch instructions, to help
- guide the processor's caching decisions.
- </para>
- <para>
- Currently, the primops get translated into
- the associated hardware supported prefetch
- instructions only with the LLVM backend and
- x86/amd64 backends. On all other backends,
- the prefetch primops are currently erased
- at code generation time.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>GHCi</title>
- <itemizedlist>
- <listitem>
- The monomorphism restriction is now turned off
- by default in GHCi.
- </listitem>
-
- <listitem>
- <para>
- GHCi now supports a <literal>prompt2</literal>
- setting, which allows you to customize the
- continuation prompt of multi-line input.
-
- For more information, see <xref linkend="ghci-commands"/>.
- </para>
- </listitem>
- <listitem>
- <para>
- The new <literal>:shows paths</literal> command
- shows the current working directory and the
- current search path for Haskell modules.
- </para>
- </listitem>
-
- <listitem>
- <para>
- On Linux, the static GHCi linker now supports weak symbols.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The (static) GHCi linker (except 64-bit Windows) now runs
- constructors for linked libraries. This means for example
- that C code using
- <literal>__attribute__((constructor))</literal>
- can now properly be loaded into GHCi.
- </para>
-
- <para>
- Note: destructors are not supported.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Template Haskell</title>
- <itemizedlist>
- <listitem>
- <para>
- Template Haskell now supports Roles.
- </para>
- </listitem>
- <listitem>
- <para>
- Template Haskell now supports annotation pragmas.
- </para>
- </listitem>
- <listitem>
- <para>
- Typed Template Haskell expressions are now supported. See
- <xref linkend="template-haskell"/> for more details.
- </para>
- </listitem>
- <listitem>
- <para>
- Template Haskell declarations, types, patterns, and
- <emphasis>untyped</emphasis> expressions are no longer
- typechecked at all. This is a backwards-compatible change
- since it allows strictly more programs to be typed.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Runtime system</title>
- <itemizedlist>
- <listitem>
- <para>
- The RTS linker can now unload object code at
- runtime (when using the GHC API
- <literal>ObjLink</literal> module.) Previously,
- GHC would not unload the old object file, causing
- a gradual memory leak as more objects were loaded
- over time.
- </para>
-
- <para>
- Note that this change in unloading behavior
- <emphasis>only</emphasis> affects statically
- linked binaries, and not dynamic ones.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The performance of <literal>StablePtr</literal>s and
- <literal>StableName</literal>s has been improved.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The default maximum stack size has
- increased. Previously, it defaulted to 8m
- (equivalent to passing <literal>+RTS
- -K8m</literal>. Now, GHC will use up-to 80% of the
- <emphasis>physical memory</emphasis> available at
- runtime.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Build system</title>
- <itemizedlist>
- <listitem>
- <para>
- GHC >= 7.4 is now required for bootstrapping.
- </para>
- </listitem>
- <listitem>
- <para>
- GHC can now be built with Clang, and use Clang as
- the preprocessor for Haskell code. Only Clang
- version 3.4 (or Apple LLVM Clang 5.0) or beyond is
- reliably supported.
- </para>
-
- <para>
- Note that normally, GHC uses
- <literal>gcc</literal> as the preprocessor for
- Haskell code, which implements
- <literal>-traditional</literal> behavior. However,
- Clang is not 100% compatible with GCC's
- <literal>-traditional</literal> as it is rather
- implementation specified, and is more strict.
- </para>
-
- <para>
- As a result of this, when using Clang as the
- preprocessor, some programs which previously used
- <literal>-XCPP</literal> and the preprocessor will
- now fail to compile. Users who wish to retain the
- previous behavior are better off using cpphs.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- </sect2>
-
- <sect2>
- <title>Libraries</title>
-
- <sect3>
- <title>array</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.5.0.0 (was 0.4.0.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>base</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 4.7.0.0 (was 4.6.0.1)
- </para>
- </listitem>
- <listitem>
- <para>
- The <literal>Control.Category</literal> module now has the
- <literal>PolyKinds</literal> extension enabled, meaning
- that instances of <literal>Category</literal> no longer
- need be of kind <literal>* -> * -> *</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Foldable</literal> and <literal>Traversable</literal>
- instances for <literal>Either a</literal>, <literal>Const r</literal>, and <literal>(,) a</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There is now a <literal>Monoid</literal> instance for <literal>Const</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There is now a <literal>Data</literal> instance for <literal>Data.Version</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Data</literal>,
- <literal>Typeable</literal>, and
- <literal>Generic</literal> instances for the types
- in <literal>Data.Monoid</literal> and
- <literal>Control.Applicative</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Num</literal> instances for <literal>Data.Monoid.Product</literal> and <literal>Data.Monoid.Sum</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Eq</literal>, <literal>Ord</literal>, <literal>Show</literal> and <literal>Read</literal> instances for <literal>ZipList</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Eq</literal>, <literal>Ord</literal>, <literal>Show</literal> and <literal>Read</literal> instances for <literal>Down</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There are now <literal>Eq</literal>, <literal>Ord</literal>, <literal>Show</literal>, <literal>Read</literal> and <literal>Generic</literal> instances for types in GHC.Generics (<literal>U1</literal>, <literal>Par1</literal>, <literal>Rec1</literal>, <literal>K1</literal>, <literal>M1</literal>, <literal>(:+:)</literal>, <literal>(:*:)</literal>, <literal>(:.:)</literal>).
- </para>
- </listitem>
- <listitem>
- <para>
- A zero-width unboxed poly-kinded <literal>Proxy#</literal>
- was added to <literal>GHC.Prim</literal>. It can be used to make it so
- that there is no the operational overhead for passing around proxy
- arguments to model type application.
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>Control.Concurrent.MVar</literal> has a new
- implementation of <literal>readMVar</literal>, which
- fixes a long-standing bug where
- <literal>readMVar</literal> is only atomic if there
- are no other threads running
- <literal>putMVar</literal>.
- <literal>readMVar</literal> now is atomic, and is
- guaranteed to return the value from the first
- <literal>putMVar</literal>. There is also a new <literal>tryReadMVar</literal>
- which is a non-blocking version.
- </para>
- </listitem>
- <listitem>
- <para>
- There are now byte endian-swapping primitives
- available in <literal>Data.Word</literal>, which
- use optimized machine instructions when available.
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>Data.Bool</literal> now exports
- <literal>bool :: a -> a -> Bool -> a</literal>, analogously
- to <literal>maybe</literal> and <literal>either</literal>
- in their respective modules.
- </para>
- </listitem>
- <listitem>
- <para>
- Rewrote portions of <literal>Text.Printf</literal>, and
- made changes to <literal>Numeric</literal> (added
- <literal>Numeric.showFFloatAlt</literal> and
- <literal>Numeric.showGFloatAlt</literal>) and
- <literal>GHC.Float</literal> (added
- <literal>formatRealFloatAlt</literal>) to support it.
- The rewritten version is extensible to user types, adds a
- "generic" format specifier "<literal>%v</literal>",
- extends the <literal>printf</literal> spec
- to support much of C's <literal>printf(3)</literal>
- functionality, and fixes the spurious warnings about
- using <literal>Text.Printf.printf</literal> at
- <literal>(IO a)</literal> while ignoring the return value.
- These changes were contributed by Bart Massey.
- </para>
- </listitem>
- <listitem>
- <para>
- The minimal complete definitions for all
- type-classes with cyclic default implementations
- have been explicitly annotated with the new
- <literal>{-# MINIMAL #-}</literal> pragma.
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>Control.Applicative.WrappedMonad</literal>,
- which can be used to convert a <literal>Monad</literal>
- to an <literal>Applicative</literal>, has now
- a <literal>Monad m => Monad (WrappedMonad m)</literal>
- instance.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>bin-package-db</title>
- <itemizedlist>
- <listitem>
- <para>
- This is an internal package, and should not be used.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>binary</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.7.1.0 (was 0.5.1.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>bytestring</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.10.4.0 (was 0.10.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Cabal</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.18.1.3 (was 1.16.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>containers</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.5.4.0 (was 0.5.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>deepseq</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.3.0.2 (was 1.3.0.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>directory</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.2.0.2 (was 1.2.0.1)
- </para>
- </listitem>
- <listitem>
- <para>
- The function <literal>findExecutables</literal>
- now correctly checks to see if the execute bit is
- set on Linux, rather than just looking in
- <literal>$PATH</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- There are several new functions for finding files,
- including <literal>findFiles</literal> and
- <literal>findFilesWith</literal>, which allow you
- to search for a file given a set of filepaths, and
- run a predicate over them.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>filepath</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.3.0.2 (was 1.3.0.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>ghc-prim</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.3.1.0 (was 0.3.0.0)
- </para>
- </listitem>
- <listitem>
- <para>
- The type-classes <literal>Eq</literal> and
- <literal>Ord</literal> have been annotated with
- the new <literal>{-# MINIMAL #-}</literal>
- pragma.
- </para>
- </listitem>
- <listitem>
- <para>
- There is a new type exposed by
- <literal>GHC.Types</literal>, called
- <literal>SPEC</literal>, which can be used to
- inform GHC to perform call-pattern specialisation
- extremely aggressively. See <xref
- linkend="options-optimise"/> for more details
- concerning <literal>-fspec-constr</literal>.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>haskell98</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 2.0.0.3 (was 2.0.0.2)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>haskell2010</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.1.1.1 (was 1.1.1.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>hoopl</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 3.10.0.0 (was 3.9.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>hpc</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.6.0.1 (was 0.6.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>integer-gmp</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 0.5.1.0 (was 0.5.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>old-locale</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.0.0.6 (was 1.0.0.5)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>old-time</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.1.0.2 (was 1.1.0.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>process</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.2.0.0 (was 1.1.0.2)
- </para>
- </listitem>
- <listitem>
- <para>
- Several bugs have been fixed, including deadlocks
- in <literal>readProcess</literal> and
- <literal>readProcessWithExitCode</literal>.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>template-haskell</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 2.9.0.0 (was 2.8.0.0)
- </para>
- </listitem>
- <listitem>
- <para>
- Typed Template Haskell expressions are now
- supported. See <xref linkend="template-haskell"/>
- for more details.
- </para>
- </listitem>
- <listitem>
- <para>
- There is now support for roles.
- </para>
- </listitem>
- <listitem>
- <para>
- There is now support for annotation pragmas.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>time</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 1.4.1 (was 1.4.1)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>unix</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 2.7.0.0 (was 2.6.0.0)
- </para>
- </listitem>
- <listitem>
- <para>
- A crash in <literal>getGroupEntryForID</literal>
- (and related functions like
- <literal>getUserEntryForID</literal> and
- <literal>getUserEntryForName</literal>) in
- multi-threaded applications has been fixed.
- </para>
- </listitem>
- <listitem>
- <para>
- The functions <literal>getGroupEntryForID</literal>
- and <literal>getUserEntryForID</literal> now fail
- with a <literal>isDoesNotExist</literal> error when
- the specified ID cannot be found.
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
-
- <sect3>
- <title>Win32</title>
- <itemizedlist>
- <listitem>
- <para>
- Version number 2.3.0.1 (was 2.3.0.0)
- </para>
- </listitem>
- </itemizedlist>
- </sect3>
- </sect2>
-
- <sect2>
- <title>Known bugs</title>
- <itemizedlist>
- <listitem>
- <para>
- On OS X Mavericks, when using Clang as the C
- preprocessor, Haddock has a bug that causes it to fail
- to generate documentation, with an error similar to
- the following:
-
-<programlisting>
-&lt;no location info&gt;:
- module 'xhtml-3000.2.1:Main' is defined in multiple files: dist-bindist/build/tmp-72252/Text/XHtml.hs
- dist-bindist/build/tmp-72252/Text/XHtml/Frameset.hs
- dist-bindist/build/tmp-72252/Text/XHtml/Strict.hs
- dist-bindist/build/tmp-72252/Text/XHtml/Transitional.hs
-...
-</programlisting>
-
- </para>
- <para>
- This only affects certain packages. This is due to a
- bad interaction with Clang, which we hope to resolve
- soon.
- </para>
- <para>
- Note that when using <literal>cabal-install</literal>,
- this only effects the package documentation, not
- installation or building.
- </para>
- </listitem>
- <listitem>
- <para>
- On OS X 10.7 and beyond, with default build settings,
- the runtime system currently suffers from a fairly
- large (approx. 30%) performance regression in the
- parallel garbage collector when using
- <literal>-threaded</literal>.
- </para>
- <para>
- This is due to the fact that the OS X 10.7+ toolchain
- does not (by default) support register variables, or a
- fast <literal>__thread</literal> implementation. Note
- that this can be worked around by building GHC using
- GCC instead on OS X platforms, but the binary
- distribution then requires GCC later.
- </para>
- </listitem>
-
- <listitem>
- <para>
- On Windows, <literal>-dynamic-too</literal> is unsupported.
- </para>
- </listitem>
-
- <listitem>
- <para>
- On Windows, we currently don't ship dynamic libraries
- or use a dynamic GHCi, unlike Linux, FreeBSD or OS X.
- </para>
- </listitem>
- </itemizedlist>
- </sect2>
-</sect1>
diff --git a/docs/users_guide/codegens.xml b/docs/users_guide/codegens.xml
index 2eb9408c6c..d2a805a3ee 100644
--- a/docs/users_guide/codegens.xml
+++ b/docs/users_guide/codegens.xml
@@ -38,7 +38,7 @@
<para>You must install and have LLVM available on your PATH for the LLVM
code generator to work. Specifically GHC needs to be able to call the
- <command>opt</command>and <command>llc</command> tools. Secondly, if you
+ <command>opt</command> and <command>llc</command> tools. Secondly, if you
are running Mac OS X with LLVM 3.0 or greater then
you also need the <ulink url="http://clang.llvm.org">Clang c
compiler</ulink> compiler available on your PATH.
diff --git a/docs/users_guide/external_core.xml b/docs/users_guide/external_core.xml
deleted file mode 100644
index e4354410ef..0000000000
--- a/docs/users_guide/external_core.xml
+++ /dev/null
@@ -1,1804 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-This document is a semi-automatic conversion of docs/ext-core/core.tex to DocBook using
-
-1. `htlatex` to convert LaTeX to HTML
-2. `pandoc` to convert HTML to DocBook
-3. extensive manual work by James H. Fisher (jameshfisher@gmail.com)
--->
-
-<!--
-TODO:
-
-* Replace "java" programlisting with "ghccore"
-("ghccore" is not recognized by highlighters,
-causing some generators to fail).
-
-* Complete bibliography entries with journal titles;
-I am unsure of the proper DocBook elements.
-
-* Integrate this file with the rest of the Users' Guide.
--->
-
-
-<chapter id="an-external-representation-for-the-ghc-core-language-for-ghc-6.10">
- <title>An External Representation for the GHC Core Language (For GHC 6.10)</title>
-
- <para>Andrew Tolmach, Tim Chevalier ({apt,tjc}@cs.pdx.edu) and The GHC Team</para>
-
- <para>This chapter provides a precise definition for the GHC Core
- language, so that it can be used to communicate between GHC and new
- stand-alone compilation tools such as back-ends or
- optimizers.<footnote>
- <para>This is a draft document, which attempts
- to describe GHC’s current behavior as precisely as possible. Working
- notes scattered throughout indicate areas where further work is
- needed. Constructive comments are very welcome, both on the
- presentation, and on ways in which GHC could be improved in order to
- simplify the Core story.</para>
-
- <para>Support for generating external Core (post-optimization) was
- originally introduced in GHC 5.02. The definition of external Core in
- this document reflects the version of external Core generated by the
- HEAD (unstable) branch of GHC as of May 3, 2008 (version 6.9), using
- the compiler flag <code>-fext-core</code>. We expect that GHC 6.10 will be
- consistent with this definition.</para>
- </footnote>
- The definition includes a formal grammar and an informal semantics.
- An executable typechecker and interpreter (in Haskell), which
- formally embody the static and dynamic semantics, are available
- separately.</para>
-
- <section id="introduction">
- <title>Introduction</title>
-
- <para>The Glasgow Haskell Compiler (GHC) uses an intermediate language,
- called <quote>Core,</quote> as its internal program representation within the
- compiler’s simplification phase. Core resembles a subset of
- Haskell, but with explicit type annotations in the style of the
- polymorphic lambda calculus (F<subscript>ω</subscript>).</para>
-
- <para>GHC’s front-end translates full Haskell 98 (plus some extensions)
- into Core. The GHC optimizer then repeatedly transforms Core
- programs while preserving their meaning. A <quote>Core Lint</quote> pass in GHC
- typechecks Core in between transformation passes (at least when
- the user enables linting by setting a compiler flag), verifying
- that transformations preserve type-correctness. Finally, GHC’s
- back-end translates Core into STG-machine code <citation>stg-machine</citation> and then into C
- or native code.</para>
-
- <para>Two existing papers discuss the original rationale for the design
- and use of Core <citation>ghc-inliner,comp-by-trans-scp</citation>, although the (two different) idealized
- versions of Core described therein differ in significant ways from
- the actual Core language in current GHC. In particular, with the
- advent of GHC support for generalized algebraic datatypes (GADTs)
- <citation>gadts</citation> Core was extended beyond its previous
- F<subscript>ω</subscript>-style incarnation to support type
- equality constraints and safe coercions, and is now based on a
- system known as F<subscript>C</subscript> <citation>system-fc</citation>.</para>
-
- <para>Researchers interested in writing just <emphasis>part</emphasis> of a Haskell compiler,
- such as a new back-end or a new optimizer pass, might like to use
- GHC to provide the other parts of the compiler. For example, they
- might like to use GHC’s front-end to parse, desugar, and
- type-check source Haskell, then feeding the resulting code to
- their own back-end tool. As another example, they might like to
- use Core as the target language for a front-end compiler of their
- own design, feeding externally synthesized Core into GHC in order
- to take advantage of GHC’s optimizer, code generator, and run-time
- system. Without external Core, there are two ways for compiler
- writers to do this: they can link their code into the GHC
- executable, which is an arduous process, or they can use the GHC
- API <citation>ghc-api</citation> to do the same task more cleanly. Both ways require new
- code to be written in Haskell.</para>
-
- <para>We present a precisely specified external format for Core files.
- The external format is text-based and human-readable, to promote
- interoperability and ease of use. We hope this format will make it
- easier for external developers to use GHC in a modular way.</para>
-
- <para>It has long been true that GHC prints an ad-hoc textual
- representation of Core if you set certain compiler flags. But this
- representation is intended to be read by people who are debugging
- the compiler, not by other programs. Making Core into a
- machine-readable, bi-directional communication format requires:
-
- <orderedlist>
- <listitem>
- precisely specifying the external format of Core;
- </listitem>
- <listitem>
- modifying GHC to generate external Core files
- (post-simplification; as always, users can control the exact
- transformations GHC does with command-line flags);
- </listitem>
- <listitem>
- modifying GHC to accept external Core files in place of
- Haskell source files (users will also be able to control what
- GHC does to those files with command-line flags).
- </listitem>
- </orderedlist>
- </para>
-
- <para>The first two facilities will let developers couple GHC’s
- front-end (parser, type-checker, desugarer), and optionally its
- optimizer, with new back-end tools. The last facility will let
- developers write new Core-to-Core transformations as an external
- tool and integrate them into GHC. It will also allow new
- front-ends to generate Core that can be fed into GHC’s optimizer
- or back-end.</para>
-
- <para>However, because there are many (undocumented) idiosyncracies in
- the way GHC produces Core from source Haskell, it will be hard for
- an external tool to produce Core that can be integrated with
- GHC-produced Core (e.g., for the Prelude), and we don’t aim to
- support this. Indeed, for the time being, we aim to support only
- the first two facilities and not the third: we define and
- implement Core as an external format that GHC can use to
- communicate with external back-end tools, and defer the larger
- task of extending GHC to support reading this external format back
- in.</para>
-
- <para>This document addresses the first requirement, a formal Core
- definition, by proposing a formal grammar for an
- <link linkend="external-grammar-of-core">external representation of Core</link>,
- and an <link linkend="informal-semantics">informal semantics</link>.</para>
-
- <para>GHC supports many type system extensions; the External Core
- printer built into GHC only supports some of them. However,
- External Core should be capable of representing any Haskell 98
- program, and may be able to represent programs that require
- certain type system extensions as well. If a program uses
- unsupported features, GHC may fail to compile it to Core when the
- -fext-core flag is set, or GHC may successfully compile it to
- Core, but the external tools will not be able to typecheck or
- interpret it.</para>
-
- <para>Formal static and dynamic semantics in the form of an executable
- typechecker and interpreter are available separately in the GHC
- source tree
- <footnote><ulink url="http://git.haskell.org/ghc.git/tree">http://git.haskell.org/ghc.git</ulink></footnote>
- under <code>utils/ext-core</code>.</para>
-
- </section>
- <section id="external-grammar-of-core">
- <title>External Grammar of Core</title>
-
- <para>In designing the external grammar, we have tried to strike a
- balance among a number of competing goals, including easy
- parseability by machines, easy readability by humans, and adequate
- structural simplicity to allow straightforward presentations of
- the semantics. Thus, we had to make some compromises.
- Specifically:</para>
-
- <itemizedlist>
- <listitem>In order to avoid explosion of parentheses, we support
- standard precedences and short-cuts for expressions, types,
- and kinds. Thus we had to introduce multiple non-terminals for
- each of these syntactic categories, and as a result, the
- concrete grammar is longer and more complex than the
- underlying abstract syntax.</listitem>
-
- <listitem>On the other hand, we have kept the grammar simpler by
- avoiding special syntax for tuple types and terms. Tuples
- (both boxed and unboxed) are treated as ordinary constructors.</listitem>
-
- <listitem>All type abstractions and applications are given in full, even
- though some of them (e.g., for tuples) could be reconstructed;
- this means a parser for Core does not have to reconstruct
- types.<footnote>
- These choices are certainly debatable. In
- particular, keeping type applications on tuples and case arms
- considerably increases the size of Core files and makes them less
- human-readable, though it allows a Core parser to be simpler.
- </footnote></listitem>
-
- <listitem>The syntax of identifiers is heavily restricted (to just
- alphanumerics and underscores); this again makes Core easier
- to parse but harder to read.</listitem>
- </itemizedlist>
-
- <para>We use the following notational conventions for syntax:
-
- <informaltable frame="none">
- <tgroup cols='2' align='left' colsep="0" rowsep="0">
- <tbody>
- <row>
- <entry>[ pat ]</entry>
- <entry>optional</entry>
- </row>
-
- <row>
- <entry>{ pat }</entry>
- <entry>zero or more repetitions</entry>
- </row>
-
- <row>
- <entry>
- { pat }<superscript>+</superscript>
- </entry>
- <entry>one or more repetitions</entry>
- </row>
-
- <row>
- <entry>
- pat<subscript>1</subscript> ∣ pat<subscript>2</subscript>
- </entry>
- <entry>choice</entry>
- </row>
-
- <row>
- <entry>
- <code>fibonacci</code>
- </entry>
- <entry>terminal syntax in typewriter font</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </para>
-
- <informaltable frame="none" colsep="0" rowsep="0">
- <tgroup cols='5'>
- <colspec colname="cat" align="left" colwidth="3*" />
- <colspec colname="lhs" align="right" colwidth="2*" />
- <colspec align="center" colwidth="*" />
- <colspec colname="rhs" align="left" colwidth="10*" />
- <colspec colname="name" align="right" colwidth="6*" />
- <tbody>
- <row rowsep="1">
- <entry>Module</entry>
- <entry>module</entry>
- <entry>→</entry>
- <entry>
- <code>%module</code> mident { tdef ; }{ vdefg ; }
- </entry>
- <entry></entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">Type defn.</entry>
- <entry morerows="1" valign="top">tdef</entry>
- <entry>→</entry>
- <entry>
- <code>%data</code> qtycon { tbind } <code>= {</code> [ cdef {<code>;</code> cdef } ] <code>}</code>
- </entry>
- <entry>algebraic type</entry>
- </row>
- <row rowsep="1">
- <entry>∣</entry>
- <entry>
- <code>%newtype</code> qtycon qtycon { tbind } <code>=</code> ty
- </entry>
- <entry>newtype</entry>
- </row>
-
- <row rowsep="1">
- <entry>Constr. defn.</entry>
- <entry>cdef</entry>
- <entry>→</entry>
- <entry>
- qdcon { <code>@</code> tbind }{ aty }<superscript>+</superscript>
- </entry>
- </row>
-
- <row>
- <entry morerows="2" valign="top">Value defn.</entry>
- <entry morerows="1" valign="top">vdefg</entry>
- <entry>→</entry>
- <entry><code>%rec {</code> vdef { <code>;</code> vdef } <code>}</code></entry>
- <entry>recursive</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>vdef</entry>
- <entry>non-recursive</entry>
- </row>
-
- <row rowsep="1">
- <entry>vdef</entry>
- <entry>→</entry>
- <entry>qvar <code>::</code> ty <code>=</code> exp</entry>
- <entry></entry>
- </row>
-
- <row>
- <entry morerows="3" valign="top">Atomic expr.</entry>
- <entry morerows="3" valign="top">aexp</entry>
- <entry>→</entry>
- <entry>qvar</entry>
- <entry>variable</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>qdcon</entry>
- <entry>data constructor</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>lit</entry>
- <entry>literal</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>(</code> exp <code>)</code></entry>
- <entry>nested expr.</entry>
- </row>
-
- <row>
- <entry morerows="9" valign="top">Expression</entry>
- <entry morerows="9" valign="top">exp</entry>
- <entry>→</entry>
- <entry>aexp</entry>
- <entry>atomic expresion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>aexp { arg }<superscript>+</superscript></entry>
- <entry>application</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>\</code> { binder }<superscript>+</superscript> &arw; exp</entry>
- <entry>abstraction</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%let</code> vdefg <code>%in</code> exp</entry>
- <entry>local definition</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%case (</code> aty <code>)</code> exp <code>%of</code> vbind <code>{</code> alt { <code>;</code> alt } <code>}</code></entry>
- <entry>case expression</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%cast</code> exp aty</entry>
- <entry>type coercion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%note</code> &quot; { char } &quot; exp</entry>
- <entry>expression note</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%external ccall &quot;</code> { char } <code>&quot;</code> aty</entry>
- <entry>external reference</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%dynexternal ccall</code> aty</entry>
- <entry>external reference (dynamic)</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>%label &quot;</code> { char } <code>&quot;</code></entry>
- <entry>external label</entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">Argument</entry>
- <entry morerows="1" valign="top">arg</entry>
- <entry>→</entry>
- <entry><code>@</code> aty</entry>
- <entry>type argument</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry>aexp</entry>
- <entry>value argument</entry>
- </row>
-
- <row>
- <entry morerows="2" valign="top">Case alt.</entry>
- <entry morerows="2" valign="top">alt</entry>
- <entry>→</entry>
- <entry>qdcon { <code>@</code> tbind }{ vbind } <code>&arw;</code> exp</entry>
- <entry>constructor alternative</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>lit <code>&arw;</code> exp</entry>
- <entry>literal alternative</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>%_ &arw;</code> exp</entry>
- <entry>default alternative</entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">Binder</entry>
- <entry morerows="1" valign="top">binder</entry>
- <entry>→</entry>
- <entry><code>@</code> tbind</entry>
- <entry>type binder</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry>vbind</entry>
- <entry>value binder</entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">Type binder</entry>
- <entry morerows="1" valign="top">tbind</entry>
- <entry>→</entry>
- <entry>tyvar</entry>
- <entry>implicitly of kind *</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>(</code> tyvar <code>::</code> kind <code>)</code></entry>
- <entry>explicitly kinded</entry>
- </row>
-
- <row rowsep="1">
- <entry>Value binder</entry>
- <entry>vbind</entry>
- <entry>→</entry>
- <entry><code>(</code> var <code>::</code> ty <code>)</code></entry>
- <entry></entry>
- </row>
-
- <row>
- <entry morerows="3" valign="top">Literal</entry>
- <entry morerows="3" valign="top">lit</entry>
- <entry>→</entry>
- <entry><code>(</code> [<code>-</code>] { digit }<superscript>+</superscript> <code>::</code> ty <code>)</code></entry>
- <entry>integer</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>(</code> [<code>-</code>] { digit }<superscript>+</superscript> <code>%</code> { digit }<superscript>+</superscript> <code>::</code> ty <code>)</code></entry>
- <entry>rational</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>( '</code> char <code>' ::</code> ty <code>)</code></entry>
- <entry>character</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>( &quot;</code> { char } <code>&quot; ::</code> ty <code>)</code></entry>
- <entry>string</entry>
- </row>
-
- <row>
- <entry morerows="2" valign="top">Character</entry>
- <entry morerows="1" valign="top">char</entry>
- <entry>→</entry>
- <entry namest="rhs" nameend="name"><emphasis>any ASCII character in range 0x20-0x7E except 0x22,0x27,0x5c</emphasis></entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>\x</code> hex hex</entry>
- <entry>ASCII code escape sequence</entry>
- </row>
-
- <row rowsep="1">
- <entry>hex</entry>
- <entry>→</entry>
- <entry>0∣…∣9 ∣a ∣…∣f</entry>
- <entry></entry>
- </row>
-
- <row>
- <entry morerows="2" valign="top">Atomic type</entry>
- <entry morerows="2" valign="top">aty</entry>
- <entry>→</entry>
- <entry>tyvar</entry>
- <entry>type variable</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>qtycon</entry>
- <entry>type constructor</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>(</code> ty <code>)</code></entry>
- <entry>nested type</entry>
- </row>
-
- <row>
- <entry morerows="7" valign="top">Basic type</entry>
- <entry morerows="7" valign="top">bty</entry>
- <entry>→</entry>
- <entry>aty</entry>
- <entry>atomic type</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>bty aty</entry>
- <entry>type application</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%trans</code> aty aty</entry>
- <entry>transitive coercion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%sym</code> aty</entry>
- <entry>symmetric coercion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%unsafe</code> aty aty</entry>
- <entry>unsafe coercion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%left</code> aty</entry>
- <entry>left coercion</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%right</code> aty</entry>
- <entry>right coercion</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>%inst</code> aty aty</entry>
- <entry>instantiation coercion</entry>
- </row>
-
- <row>
- <entry morerows="2" valign="top">Type</entry>
- <entry morerows="2" valign="top">ty</entry>
- <entry>→</entry>
- <entry>bty</entry>
- <entry>basic type</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>%forall</code> { tbind }<superscript>+</superscript> <code>.</code> ty</entry>
- <entry>type abstraction</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry>bty <code>&arw;</code> ty</entry>
- <entry>arrow type construction</entry>
- </row>
-
- <row>
- <entry morerows="4" valign="top">Atomic kind</entry>
- <entry morerows="4" valign="top">akind</entry>
- <entry>→</entry>
- <entry><code>*</code></entry>
- <entry>lifted kind</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>#</code></entry>
- <entry>unlifted kind</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry><code>?</code></entry>
- <entry>open kind</entry>
- </row>
-
- <row>
- <entry>∣</entry>
- <entry>bty <code>:=:</code> bty</entry>
- <entry>equality kind</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry><code>(</code> kind <code>)</code></entry>
- <entry>nested kind</entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">Kind</entry>
- <entry morerows="1" valign="top">kind</entry>
- <entry>→</entry>
- <entry>akind</entry>
- <entry>atomic kind</entry>
- </row>
-
- <row rowsep="1">
- <entry>∣</entry>
- <entry>akind <code>&arw;</code> kind</entry>
- <entry>arrow kind</entry>
- </row>
-
- <row>
- <entry morerows="7" valign="top">Identifier</entry>
- <entry>mident</entry>
- <entry>→</entry>
- <entry>pname <code>:</code> uname</entry>
- <entry>module</entry>
- </row>
-
- <row>
- <entry>tycon</entry>
- <entry>→</entry>
- <entry>uname</entry>
- <entry>type constr.</entry>
- </row>
-
- <row>
- <entry>qtycon</entry>
- <entry>→</entry>
- <entry>mident <code>.</code> tycon</entry>
- <entry>qualified type constr.</entry>
- </row>
-
- <row>
- <entry>tyvar</entry>
- <entry>→</entry>
- <entry>lname</entry>
- <entry>type variable</entry>
- </row>
-
- <row>
- <entry>dcon</entry>
- <entry>→</entry>
- <entry>uname</entry>
- <entry>data constr.</entry>
- </row>
-
- <row>
- <entry>qdcon</entry>
- <entry>→</entry>
- <entry>mident <code>.</code> dcon</entry>
- <entry>qualified data constr.</entry>
- </row>
-
- <row>
- <entry>var</entry>
- <entry>→</entry>
- <entry>lname</entry>
- <entry>variable</entry>
- </row>
-
- <row rowsep="1">
- <entry>qvar</entry>
- <entry>→</entry>
- <entry>[ mident <code>.</code> ] var</entry>
- <entry>optionally qualified variable</entry>
- </row>
-
- <row>
- <entry morerows="6" valign="top">Name</entry>
- <entry>lname</entry>
- <entry>→</entry>
- <entry>lower { namechar }</entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>uname</entry>
- <entry>→</entry>
- <entry>upper { namechar }</entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>pname</entry>
- <entry>→</entry>
- <entry>{ namechar }<superscript>+</superscript></entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>namechar</entry>
- <entry>→</entry>
- <entry>lower ∣ upper ∣ digit</entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>lower</entry>
- <entry>→</entry>
- <entry><code>a</code> ∣ <code>b</code> ∣ … ∣ <code>z</code> ∣ <code>_</code></entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>upper</entry>
- <entry>→</entry>
- <entry><code>A</code> ∣ <code>B</code> ∣ … ∣ <code>Z</code></entry>
- <entry></entry>
- </row>
-
- <row>
- <entry>digit</entry>
- <entry>→</entry>
- <entry><code>0</code> ∣ <code>1</code> ∣ … ∣ <code>9</code></entry>
- <entry></entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
-
- <section id="informal-semantics">
- <title>Informal Semantics</title>
-
- <para>At the term level, Core resembles a explicitly-typed polymorphic
- lambda calculus (F<subscript>ω</subscript>), with the addition of
- local <code>let</code> bindings, algebraic type definitions, constructors, and
- <code>case</code> expressions, and primitive types, literals and operators. Its
- type system is richer than that of System F, supporting explicit
- type equality coercions and type functions.<citation>system-fc</citation></para>
-
- <para>In this section we concentrate on the less obvious points about
- Core.</para>
-
- <section id="program-organization-and-modules">
- <title>Program Organization and Modules</title>
-
- <para>Core programs are organized into <emphasis>modules</emphasis>, corresponding directly
- to source-level Haskell modules. Each module has a identifying
- name <emphasis>mident</emphasis>. A module identifier consists of a <emphasis>package name</emphasis>
- followed by a module name, which may be hierarchical: for
- example, <code>base:GHC.Base</code> is the module identifier for GHC’s Base
- module. Its name is <code>Base</code>, and it lives in the GHC hierarchy
- within the <code>base</code> package. Section 5.8 of the GHC users’ guide
- explains package names <citation>ghc-user-guide</citation>. In particular, note that a Core
- program may contain multiple modules with the same (possibly
- hierarchical) module name that differ in their package names. In
- some of the code examples that follow, we will omit package
- names and possibly full hierarchical module names from
- identifiers for brevity, but be aware that they are always
- required.<footnote>
- A possible improvement to the Core syntax
- would be to add explicit import lists to Core modules, which could be
- used to specify abbrevations for long qualified names. This would make
- the code more human-readable.
- </footnote></para>
-
- <para>Each module may contain the following kinds of top-level
- declarations:
-
- <itemizedlist>
- <listitem>
- Algebraic data type declarations, each defining a type
- constructor and one or more data constructors;
- </listitem>
- <listitem>
- Newtype declarations, corresponding to Haskell <code>newtype</code>
- declarations, each defining a type constructor and a
- coercion name; and
- </listitem>
- <listitem>
- Value declarations, defining the types and values of
- top-level variables.
- </listitem>
- </itemizedlist>
- </para>
-
- <para>No type constructor, data constructor, or top-level value may be
- declared more than once within a given module. All the type
- declarations are (potentially) mutually recursive. Value
- declarations must be in dependency order, with explicit grouping
- of potentially mutually recursive declarations.</para>
-
- <para>Identifiers defined in top-level declarations may be <emphasis>external</emphasis> or
- <emphasis>internal</emphasis>. External identifiers can be referenced from any other
- module in the program, using conventional dot notation (e.g.,
- <code>base:GHC.Base.Bool</code>, <code>base:GHC.Base.True</code>). Internal identifiers
- are visible only within the defining module. All type and data
- constructors are external, and are always defined and referenced
- using fully qualified names (with dots).</para>
-
- <para>A top-level value is external if it is defined and referenced
- using a fully qualified name with a dot (e.g., <code>main:MyModule.foo = ...</code>);
- otherwise, it is internal (e.g., <code>bar = ...</code>). Note that
- Core’s notion of an external identifier does not necessarily
- coincide with that of <quote>exported</quote> identifier in a Haskell source
- module. An identifier can be an external identifier in Core, but
- not be exported by the original Haskell source
- module.<footnote>
- Two examples of such identifiers are: data
- constructors, and values that potentially appear in an unfolding. For an
- example of the latter, consider <code>Main.foo = ... Main.bar ...</code>, where
- <code>Main.foo</code> is inlineable. Since <code>bar</code> appears in <code>foo</code>’s unfolding, it is
- defined and referenced with an external name, even if <code>bar</code> was not
- exported by the original source module.
- </footnote>
- However, if an identifier was exported by the Haskell source
- module, it will appear as an external name in Core.</para>
-
- <para>Core modules have no explicit import or export lists. Modules
- may be mutually recursive. Note that because of the latter fact,
- GHC currently prints out the top-level bindings for every module
- as a single recursive group, in order to avoid keeping track of
- dependencies between top-level values within a module. An
- external Core tool could reconstruct dependencies later, of
- course.</para>
-
- <para>There is also an implicitly-defined module <code>ghc-prim:GHC.Prim</code>,
- which exports the <quote>built-in</quote> types and values that must be
- provided by any implementation of Core (including GHC). Details
- of this module are in the <link linkend="primitive-module">Primitive Module section</link>.</para>
-
- <para>A Core <emphasis>program</emphasis> is a collection of distinctly-named modules that
- includes a module called main:Main having an exported value
- called <code>main:ZCMain.main</code> of type <code>base:GHC.IOBase.IO a</code> (for some
- type <code>a</code>). (Note that the strangely named wrapper for <code>main</code> is the
- one exception to the rule that qualified names defined within a
- module <code>m</code> must have module name <code>m</code>.)</para>
-
- <para>Many Core programs will contain library modules, such as
- <code>base:GHC.Base</code>, which implement parts of the Haskell standard
- library. In principle, these modules are ordinary Haskell
- modules, with no special status. In practice, the requirement on
- the type of <code>main:Main.main</code> implies that every program will
- contain a large subset of the standard library modules.</para>
-
- </section>
- <section id="namespaces">
- <title>Namespaces</title>
-
- <para>There are five distinct namespaces:
- <orderedlist>
- <listitem>module identifiers (<code>mident</code>),</listitem>
- <listitem>type constructors (<code>tycon</code>),</listitem>
- <listitem>type variables (<code>tyvar</code>),</listitem>
- <listitem>data constructors (<code>dcon</code>),</listitem>
- <listitem>term variables (<code>var</code>).</listitem>
- </orderedlist>
- </para>
-
- <para>Spaces (1), (2+3), and (4+5) can be distinguished from each
- other by context. To distinguish (2) from (3) and (4) from (5),
- we require that data and type constructors begin with an
- upper-case character, and that term and type variables begin
- with a lower-case character.</para>
-
- <para>Primitive types and operators are not syntactically
- distinguished.</para>
-
- <para>Primitive <emphasis>coercion</emphasis> operators, of which there are six, <emphasis>are</emphasis>
- syntactically distinguished in the grammar. This is because
- these coercions must be fully applied, and because
- distinguishing their applications in the syntax makes
- typechecking easier.</para>
-
- <para>A given variable (type or term) may have multiple definitions
- within a module. However, definitions of term variables never
- <quote>shadow</quote> one another: the scope of the definition of a given
- variable never contains a redefinition of the same variable.
- Type variables may be shadowed. Thus, if a term variable has
- multiple definitions within a module, all those definitions must
- be local (let-bound). The only exception to this rule is that
- (necessarily closed) types labelling <code>%external</code> expressions may
- contain <code>tyvar</code> bindings that shadow outer bindings.</para>
-
- <para>Core generated by GHC makes heavy use of encoded names, in which
- the characters <code>Z</code> and <code>z</code> are used to introduce escape sequences
- for non-alphabetic characters such as dollar sign <code>$</code> (<code>zd</code>), hash <code>#</code>
- (<code>zh</code>), plus <code>+</code> (<code>zp</code>), etc. This is the same encoding used in <code>.hi</code>
- files and in the back-end of GHC itself, except that we
- sometimes change an initial <code>z</code> to <code>Z</code>, or vice-versa, in order to
- maintain case distinctions.</para>
-
- <para>Finally, note that hierarchical module names are z-encoded in
- Core: for example, <code>base:GHC.Base.foo</code> is rendered as
- <code>base:GHCziBase.foo</code>. A parser may reconstruct the module
- hierarchy, or regard <code>GHCziBase</code> as a flat name.</para>
-
- </section>
- <section id="types-and-kinds">
- <title>Types and Kinds</title>
-
- <para>In Core, all type abstractions and applications are explicit.
- This make it easy to typecheck any (closed) fragment of Core
- code. An full executable typechecker is available separately.</para>
-
- <section id="types">
- <title>Types</title>
-
- <para>Types are described by type expressions, which are built from
- named type constructors and type variables using type
- application and universal quantification. Each type
- constructor has a fixed arity ≥ 0. Because it is so widely
- used, there is special infix syntax for the fully-applied
- function type constructor (<code>&arw;</code>). (The prefix identifier for
- this constructor is <code>ghc-prim:GHC.Prim.ZLzmzgZR</code>; this should
- only appear in unapplied or partially applied form.)</para>
-
- <para>There are also a number of other primitive type constructors
- (e.g., <code>Intzh</code>) that are predefined in the <code>GHC.Prim</code> module, but
- have no special syntax. <code>%data</code> and <code>%newtype</code> declarations
- introduce additional type constructors, as described below.
- Type constructors are distinguished solely by name.</para>
-
- </section>
- <section id="coercions">
- <title>Coercions</title>
-
- <para>A type may also be built using one of the primitive coercion
- operators, as described in <link linkend="namespaces">the Namespaces section</link>. For details on the
- meanings of these operators, see the System FC paper <citation>system-fc</citation>. Also
- see <link linkend="newtypes">the Newtypes section</link> for
- examples of how GHC uses coercions in Core code.</para>
-
- </section>
- <section id="kinds">
- <title>Kinds</title>
- <para>As described in the Haskell definition, it is necessary to
- distinguish well-formed type-expressions by classifying them
- into different <emphasis>kinds</emphasis> <citation>haskell98, p. 41</citation><!-- TODO -->. In particular, Core
- explicitly records the kind of every bound type variable.</para>
-
- <para>In addition, Core’s kind system includes equality kinds, as in
- System FC <citation>system-fc</citation>. An application of a built-in coercion, or of a
- user-defined coercion as introduced by a <code>newtype</code> declaration,
- has an equality kind.</para>
-
- </section>
- <section id="lifted-and-unlifted-types">
- <title>Lifted and Unlifted Types</title>
-
- <para>Semantically, a type is <emphasis>lifted</emphasis> if and only if it has bottom as
- an element. We need to distinguish them because operationally,
- terms with lifted types may be represented by closures; terms
- with unlifted types must not be represented by closures, which
- implies that any unboxed value is necessarily unlifted. We
- distinguish between lifted and unlifted types by ascribing
- them different kinds.</para>
-
- <para>Currently, all the primitive types are unlifted (including a
- few boxed primitive types such as <code>ByteArrayzh</code>). Peyton-Jones
- and Launchbury <citation>pj:unboxed</citation> described the ideas behind unboxed and
- unlifted types.</para>
-
- </section>
- <section id="type-constructors-base-kinds-and-higher-kinds">
- <title>Type Constructors; Base Kinds and Higher Kinds</title>
-
- <para>Every type constructor has a kind, depending on its arity and
- whether it or its arguments are lifted.</para>
-
- <para>Term variables can only be assigned types that have base
- kinds: the base kinds are <code>*</code>, <code>#</code>, and <code>?</code>. The three base kinds
- distinguish the liftedness of the types they classify: <code>*</code>
- represents lifted types; <code>#</code> represents unlifted types; and <code>?</code> is
- the <quote>open</quote> kind, representing a type that may be either lifted
- or unlifted. Of these, only <code>*</code> ever appears in Core type
- declarations generated from user code; the other two are
- needed to describe certain types in primitive (or otherwise
- specially-generated) code (which, after optimization, could
- potentially appear anywhere).</para>
-
- <para>In particular, no top-level identifier (except in
- <code>ghc-prim:GHC.Prim</code>) has a type of kind <code>#</code> or <code>?</code>.</para>
-
- <para>Nullary type constructors have base kinds: for example, the
- type <code>Int</code> has kind <code>*</code>, and <code>Int#</code> has kind <code>#</code>.</para>
-
- <para>Non-nullary type constructors have higher kinds: kinds that
- have the form
- k<subscript>1</subscript><code>&arw;</code>k<subscript>2</subscript>, where
- k<subscript>1</subscript> and k<subscript>2</subscript> are
- kinds. For example, the function type constructor <code>&arw;</code> has
- kind <code>* &arw; (* &arw; *)</code>. Since Haskell allows abstracting
- over type constructors, type variables may have higher kinds;
- however, much more commonly they have kind <code>*</code>, so that is the
- default if a type binder omits a kind.</para>
-
- </section>
-
- <section id="type-synonyms-and-type-equivalence">
- <title>Type Synonyms and Type Equivalence</title>
-
- <para>There is no mechanism for defining type synonyms
- (corresponding to Haskell <code>type</code> declarations).</para>
-
- <para>Type equivalence is just syntactic equivalence on type
- expressions (of base kinds) modulo:</para>
-
- <itemizedlist>
- <listitem>alpha-renaming of variables bound in <code>%forall</code> types;</listitem>
- <listitem>the identity a <code>&arw;</code> b ≡ <code>ghc-prim:GHC.Prim.ZLzmzgZR</code> a b</listitem>
- </itemizedlist>
-
- </section>
- </section>
- <section id="algebraic-data-types">
- <title>Algebraic data types</title>
-
- <para>Each data declaration introduces a new type constructor and a
- set of one or more data constructors, normally corresponding
- directly to a source Haskell <code>data</code> declaration. For example, the
- source declaration
-
- <programlisting language="haskell">
-data Bintree a =
- Fork (Bintree a) (Bintree a)
- | Leaf a
- </programlisting>
-
- might induce the following Core declaration
-
- <programlisting language="java">
-%data Bintree a = {
- Fork (Bintree a) (Bintree a);
- Leaf a)}
- </programlisting>
-
- which introduces the unary type constructor Bintree of kind
- <code>*&arw;*</code> and two data constructors with types
-
- <programlisting language="java">
-Fork :: %forall a . Bintree a &arw; Bintree a &arw; Bintree a
-Leaf :: %forall a . a &arw; Bintree a
- </programlisting>
-
- We define the <emphasis>arity</emphasis> of each data constructor to be the number of
- value arguments it takes; e.g. <code>Fork</code> has arity 2 and <code>Leaf</code> has
- arity 1.</para>
-
- <para>For a less conventional example illustrating the possibility of
- higher-order kinds, the Haskell source declaration
-
- <programlisting language="haskell">
-data A f a = MkA (f a)
- </programlisting>
-
- might induce the Core declaration
-
- <programlisting language="java">
-%data A (f::*&arw;*) a = { MkA (f a) }
- </programlisting>
-
- which introduces the constructor
-
- <programlisting language="java">
-MkA :: %forall (f::*&arw;*) a . (f a) &arw; (A f) a
- </programlisting></para>
-
- <para>GHC (like some other Haskell implementations) supports an
- extension to Haskell98 for existential types such as
-
- <programlisting language="haskell">
-data T = forall a . MkT a (a &arw; Bool)
- </programlisting>
-
- This is represented by the Core declaration
-
- <programlisting language="java">
-%data T = {MkT @a a (a &arw; Bool)}
- </programlisting>
-
- which introduces the nullary type constructor T and the data
- constructor
-
- <programlisting language="java">
-MkT :: %forall a . a &arw; (a &arw; Bool) &arw; T
- </programlisting>
-
- In general, existentially quantified variables appear as extra
- universally quantified variables in the data contructor types. An
- example of how to construct and deconstruct values of type <code>T</code> is
- shown in <link linkend="expression-forms">the Expression Forms section</link>.</para>
-
- </section>
- <section id="newtypes">
- <title>Newtypes</title>
-
- <para>Each Core <code>%newtype</code> declaration introduces a new type constructor
- and an associated representation type, corresponding to a source
- Haskell <code>newtype</code> declaration. However, unlike in source Haskell,
- a <code>%newtype</code> declaration does not introduce any data constructors.</para>
-
- <para>Each <code>%newtype</code> declaration also introduces a new coercion
- (syntactically, just another type constructor) that implies an
- axiom equating the type constructor, applied to any type
- variables bound by the <code>%newtype</code>, to the representation type.</para>
-
- <para>For example, the Haskell fragment
-
- <programlisting language="haskell">
-newtype U = MkU Bool
-u = MkU True
-v = case u of
- MkU b &arw; not b
- </programlisting>
-
- might induce the Core fragment
-
- <programlisting language="java">
-%newtype U ZCCoU = Bool;
-u :: U = %cast (True)
- ((%sym ZCCoU));
-v :: Bool = not (%cast (u) ZCCoU);
- </programlisting></para>
-
- <para>The <code>newtype</code> declaration implies that the types <code>U</code> and <code>Bool</code> have
- equivalent representations, and the coercion axiom <code>ZCCoU</code>
- provides evidence that <code>U</code> is equivalent to <code>Bool</code>. Notice that in
- the body of <code>u</code>, the boolean value <code>True</code> is cast to type <code>U</code> using
- the primitive symmetry rule applied to <code>ZCCoU</code>: that is, using a
- coercion of kind <code>Bool :=: U</code>. And in the body of <code>v</code>, <code>u</code> is cast
- back to type <code>Bool</code> using the axiom <code>ZCCoU</code>.</para>
-
- <para>Notice that the <code>case</code> in the Haskell source code above translates
- to a <code>cast</code> in the corresponding Core code. That is because
- operationally, a <code>case</code> on a value whose type is declared by a
- <code>newtype</code> declaration is a no-op. Unlike a <code>case</code> on any other
- value, such a <code>case</code> does no evaluation: its only function is to
- coerce its scrutinee’s type.</para>
-
- <para>Also notice that unlike in a previous draft version of External
- Core, there is no need to handle recursive newtypes specially.</para>
-
- </section>
-
- <section id="expression-forms">
- <title>Expression Forms</title>
-
- <para>Variables and data constructors are straightforward.</para>
-
- <para>Literal (<emphasis role="variable">lit</emphasis>) expressions consist of a literal value, in one of
- four different formats, and a (primitive) type annotation. Only
- certain combinations of format and type are permitted;
- see <link linkend="primitive-module">the Primitive Module section</link>.
- The character and string formats can describe only 8-bit ASCII characters.</para>
-
- <para>Moreover, because the operational semantics for Core interprets
- strings as C-style null-terminated strings, strings should not
- contain embedded nulls.</para>
-
- <para>In Core, value applications, type applications, value
- abstractions, and type abstractions are all explicit. To tell
- them apart, type arguments in applications and formal type
- arguments in abstractions are preceded by an <code>@ symbol</code>. (In
- abstractions, the <code>@</code> plays essentially the same role as the more
- usual Λ symbol.) For example, the Haskell source declaration
-
- <programlisting language="haskell">
-f x = Leaf (Leaf x)
- </programlisting>
-
- might induce the Core declaration
-
- <programlisting language="java">
-f :: %forall a . a &arw; BinTree (BinTree a) =
- \ @a (x::a) &arw; Leaf @(Bintree a) (Leaf @a x)
- </programlisting></para>
-
- <para>Value applications may be of user-defined functions, data
- constructors, or primitives. None of these sorts of applications
- are necessarily saturated.</para>
-
- <para>Note that the arguments of type applications are not always of
- kind <code>*</code>. For example, given our previous definition of type <code>A</code>:
-
- <programlisting language="haskell">
-data A f a = MkA (f a)
- </programlisting>
-
- the source code
-
- <programlisting language="haskell">
-MkA (Leaf True)
- </programlisting>
-
- becomes
-
- <programlisting language="java">
-(MkA @Bintree @Bool) (Leaf @Bool True)
- </programlisting></para>
-
- <para>Local bindings, of a single variable or of a set of mutually
- recursive variables, are represented by <code>%let</code> expressions in the
- usual way.</para>
-
- <para>By far the most complicated expression form is <code>%case</code>. <code>%case</code>
- expressions are permitted over values of any type, although they
- will normally be algebraic or primitive types (with literal
- values). Evaluating a <code>%case</code> forces the evaluation of the
- expression being tested (the <quote>scrutinee</quote>). The value of the
- scrutinee is bound to the variable following the <code>%of</code> keyword,
- which is in scope in all alternatives; this is useful when the
- scrutinee is a non-atomic expression (see next example). The
- scrutinee is preceded by the type of the entire <code>%case</code>
- expression: that is, the result type that all of the <code>%case</code>
- alternatives have (this is intended to make type reconstruction
- easier in the presence of type equality coercions).</para>
-
- <para>In an algebraic <code>%case</code>, all the case alternatives must be labeled
- with distinct data constructors from the algebraic type,
- followed by any existential type variable bindings (see below),
- and typed term variable bindings corresponding to the data
- constructor’s arguments. The number of variables must match the
- data constructor’s arity.</para>
-
- <para>For example, the following Haskell source expression
-
- <programlisting language="haskell">
-case g x of
- Fork l r &arw; Fork r l
- t@(Leaf v) &arw; Fork t t
- </programlisting>
-
- might induce the Core expression
-
- <programlisting language="java">
-%case ((Bintree a)) g x %of (t::Bintree a)
- Fork (l::Bintree a) (r::Bintree a) &arw;
- Fork @a r l
- Leaf (v::a) &arw;
- Fork @a t t
- </programlisting></para>
-
- <para>When performing a <code>%case</code> over a value of an
- existentially-quantified algebraic type, the alternative must
- include extra local type bindings for the
- existentially-quantified variables. For example, given
-
- <programlisting language="haskell">
-data T = forall a . MkT a (a &arw; Bool)
- </programlisting>
-
- the source
-
- <programlisting language="haskell">
-case x of
- MkT w g &arw; g w
- </programlisting>
-
- becomes
-
- <programlisting language="java">
-%case x %of (x’::T)
- MkT @b (w::b) (g::b&arw;Bool) &arw; g w
- </programlisting></para>
-
- <para>In a <code>%case</code> over literal alternatives, all the case alternatives
- must be distinct literals of the same primitive type.</para>
-
- <para>The list of alternatives may begin with a default alternative
- labeled with an underscore (<code>%_</code>), whose right-hand side will be
- evaluated if none of the other alternatives match. The default
- is optional except for in a case over a primitive type, or when
- there are no other alternatives. If the case is over neither an
- algebraic type nor a primitive type, then the list of
- alternatives must contain a default alternative and nothing
- else. For algebraic cases, the set of alternatives need not be
- exhaustive, even if no default is given; if alternatives are
- missing, this implies that GHC has deduced that they cannot
- occur.</para>
-
- <para><code>%cast</code> is used to manipulate newtypes, as described in
- <link linkend="newtypes">the Newtype section</link>. The <code>%cast</code> expression
- takes an expression and a coercion: syntactically, the coercion
- is an arbitrary type, but it must have an equality kind. In an
- expression <code>(cast e co)</code>, if <code>e :: T</code> and <code>co</code> has kind <code>T :=: U</code>, then
- the overall expression has type <code>U</code> <citation>ghc-fc-commentary</citation>. Here, <code>co</code> must be a
- coercion whose left-hand side is <code>T</code>.</para>
-
- <para>Note that unlike the <code>%coerce</code> expression that existed in previous
- versions of Core, this means that <code>%cast</code> is (almost) type-safe:
- the coercion argument provides evidence that can be verified by
- a typechecker. There are still unsafe <code>%cast</code>s, corresponding to
- the unsafe <code>%coerce</code> construct that existed in old versions of
- Core, because there is a primitive unsafe coercion type that can
- be used to cast arbitrary types to each other. GHC uses this for
- such purposes as coercing the return type of a function (such as
- error) which is guaranteed to never return:
-
- <programlisting language="haskell">
-case (error &quot;&quot;) of
- True &arw; 1
- False &arw; 2
- </programlisting>
-
- becomes:
-
- <programlisting language="java">
-%cast (error @ Bool (ZMZN @ Char))
-(%unsafe Bool Integer);
- </programlisting>
-
- <code>%cast</code> has no operational meaning and is only used in
- typechecking.</para>
-
- <para>A <code>%note</code> expression carries arbitrary internal information that
- GHC finds interesting. The information is encoded as a string.
- Expression notes currently generated by GHC include the inlining
- pragma (<code>InlineMe</code>) and cost-center labels for profiling.</para>
-
- <para>A <code>%external</code> expression denotes an external identifier, which has
- the indicated type (always expressed in terms of Haskell
- primitive types). External Core supports two kinds of external
- calls: <code>%external</code> and <code>%dynexternal</code>. Only the former is supported
- by the current set of stand-alone Core tools. In addition, there
- is a <code>%label</code> construct which GHC may generate but which the Core
- tools do not support.</para>
-
- <para>The present syntax for externals is sufficient for describing C
- functions and labels. Interfacing to other languages may require
- additional information or a different interpretation of the name
- string.</para>
-
- </section>
-
- <section id="expression-evaluation">
- <title>Expression Evaluation</title>
- <para>The dynamic semantics of Core are defined on the type-erasure of
- the program: for example, we ignore all type abstractions and
- applications. The denotational semantics of the resulting
- type-free program are just the conventional ones for a
- call-by-name language, in which expressions are only evaluated
- on demand. But Core is intended to be a call-by-<emphasis>need</emphasis> language,
- in which expressions are only evaluated once. To express the
- sharing behavior of call-by-need, we give an operational model
- in the style of Launchbury <citation>launchbury93natural</citation>.</para>
-
- <para>This section describes the model informally; a more formal
- semantics is separately available as an executable interpreter.</para>
-
- <para>To simplify the semantics, we consider only <quote>well-behaved</quote> Core
- programs in which constructor and primitive applications are
- fully saturated, and in which non-trivial expresssions of
- unlifted kind (<code>#</code>) appear only as scrutinees in <code>%case</code>
- expressions. Any program can easily be put into this form; a
- separately available preprocessor illustrates how. In the
- remainder of this section, we use <quote>Core</quote> to mean <quote>well-behaved</quote>
- Core.</para>
-
- <para>Evaluating a Core expression means reducing it to <emphasis>weak-head normal form (WHNF)</emphasis>,
- i.e., a primitive value, lambda abstraction,
- or fully-applied data constructor. Evaluating a program means
- evaluating the expression <code>main:ZCMain.main</code>.</para>
-
- <para>To make sure that expression evaluation is shared, we make use
- of a <emphasis>heap</emphasis>, which contains <emphasis>heap entries</emphasis>. A heap entry can be:
-
- <itemizedlist>
- <listitem>
- A <emphasis>thunk</emphasis>, representing an unevaluated expression, also known
- as a suspension.
- </listitem>
- <listitem>
- A <emphasis>WHNF</emphasis>, representing an evaluated expression. The result of
- evaluating a thunk is a WHNF. A WHNF is always a closure
- (corresponding to a lambda abstraction in the source
- program) or a data constructor application: computations
- over primitive types are never suspended.
- </listitem>
- </itemizedlist></para>
-
- <para><emphasis>Heap pointers</emphasis> point to heap entries: at different times, the
- same heap pointer can point to either a thunk or a WHNF, because
- the run-time system overwrites thunks with WHNFs as computation
- proceeds.</para>
-
- <para>The suspended computation that a thunk represents might
- represent evaluating one of three different kinds of expression.
- The run-time system allocates a different kind of thunk
- depending on what kind of expression it is:
-
- <itemizedlist>
- <listitem>
- A thunk for a value definition has a group of suspended
- defining expressions, along with a list of bindings between
- defined names and heap pointers to those suspensions. (A
- value definition may be a recursive group of definitions or
- a single non-recursive definition, and it may be top-level
- (global) or <code>let</code>-bound (local)).
- </listitem>
- <listitem>
- A thunk for a function application (where the function is
- user-defined) has a suspended actual argument expression,
- and a binding between the formal argument and a heap pointer
- to that suspension.
- </listitem>
- <listitem>
- A thunk for a constructor application has a suspended actual
- argument expression; the entire constructed value has a heap
- pointer to that suspension embedded in it.
- </listitem>
- </itemizedlist></para>
-
- <para>As computation proceeds, copies of the heap pointer for a given
- thunk propagate through the executing program. When another
- computation demands the result of that thunk, the thunk is
- <emphasis>forced</emphasis>: the run-time system computes the thunk’s result,
- yielding a WHNF, and overwrites the heap entry for the thunk
- with the WHNF. Now, all copies of the heap pointer point to the
- new heap entry: a WHNF. Forcing occurs only in the context of
-
- <itemizedlist>
- <listitem>evaluating the operator expression of an application;</listitem>
- <listitem>evaluating the scrutinee of a <code>case</code> expression; or</listitem>
- <listitem>evaluating an argument to a primitive or external function application</listitem>
- </itemizedlist>
- </para>
-
- <para>When no pointers to a heap entry (whether it is a thunk or WHNF)
- remain, the garbage collector can reclaim the space it uses. We
- assume this happens implicitly.</para>
-
- <para>With the exception of functions, arrays, and mutable variables,
- we intend that values of all primitive types should be held
- <emphasis>unboxed</emphasis>: they should not be heap-allocated. This does not
- violate call-by-need semantics: all primitive types are
- <emphasis>unlifted</emphasis>, which means that values of those types must be
- evaluated strictly. Unboxed tuple types are not heap-allocated
- either.</para>
-
- <para>Certain primitives and <code>%external</code> functions cause side-effects to
- state threads or to the real world. Where the ordering of these
- side-effects matters, Core already forces this order with data
- dependencies on the pseudo-values representing the threads.</para>
-
- <para>An implementation must specially support the <code>raisezh</code> and
- <code>handlezh</code> primitives: for example, by using a handler stack.
- Again, real-world threading guarantees that they will execute in
- the correct order.</para>
-
- </section>
- </section>
- <section id="primitive-module">
- <title>Primitive Module</title>
-
- <para>The semantics of External Core rely on the contents and informal
- semantics of the primitive module <code>ghc-prim:GHC.Prim</code>. Nearly all
- the primitives are required in order to cover GHC’s implementation
- of the Haskell98 standard prelude; the only operators that can be
- completely omitted are those supporting the byte-code interpreter,
- parallelism, and foreign objects. Some of the concurrency
- primitives are needed, but can be given degenerate implementations
- if it desired to target a purely sequential backend (see Section
- <link linkend="non-concurrent-back-end">the Non-concurrent Back End section</link>).</para>
-
- <para>In addition to these primitives, a large number of C library
- functions are required to implement the full standard Prelude,
- particularly to handle I/O and arithmetic on less usual types.</para>
-
- <para>For a full listing of the names and types of the primitive
- operators, see the GHC library documentation <citation>ghcprim</citation>.</para>
-
- <section id="non-concurrent-back-end">
- <title>Non-concurrent Back End</title>
-
- <para>The Haskell98 standard prelude doesn’t include any concurrency
- support, but GHC’s implementation of it relies on the existence
- of some concurrency primitives. However, it never actually forks
- multiple threads. Hence, the concurrency primitives can be given
- degenerate implementations that will work in a non-concurrent
- setting, as follows:</para>
-
- <itemizedlist>
- <listitem>
- <code>ThreadIdzh</code> can be represented by a singleton type, whose
- (unique) value is returned by <code>myThreadIdzh</code>.
- </listitem>
- <listitem>
- <code>forkzh</code> can just die with an <quote>unimplemented</quote> message.
- </listitem>
- <listitem>
- <code>killThreadzh</code> and <code>yieldzh</code> can also just die <quote>unimplemented</quote>
- since in a one-thread world, the only thread a thread can
- kill is itself, and if a thread yields the program hangs.
- </listitem>
- <listitem>
- <code>MVarzh a</code> can be represented by <code>MutVarzh (Maybe a)</code>; where a
- concurrent implementation would block, the sequential
- implementation can just die with a suitable message (since
- no other thread exists to unblock it).
- </listitem>
- <listitem>
- <code>waitReadzh</code> and <code>waitWritezh</code> can be implemented using a <code>select</code>
- with no timeout.
- </listitem>
- </itemizedlist>
- </section>
-
- <section id="literals">
- <title>Literals</title>
-
- <para>Only the following combination of literal forms and types are
- permitted:</para>
-
- <informaltable frame="none" colsep="0" rowsep="0">
- <tgroup cols='3'>
- <colspec colname="literal" align="left" colwidth="*" />
- <colspec colname="type" align="left" colwidth="*" />
- <colspec colname="description" align="left" colwidth="4*" />
- <thead>
- <row>
- <entry>Literal form</entry>
- <entry>Type</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry morerows="3" valign="top">integer</entry>
- <entry><code>Intzh</code></entry>
- <entry>Int</entry>
- </row>
- <row>
- <entry><code>Wordzh</code></entry>
- <entry>Word</entry>
- </row>
- <row>
- <entry><code>Addrzh</code></entry>
- <entry>Address</entry>
- </row>
- <row>
- <entry><code>Charzh</code></entry>
- <entry>Unicode character code</entry>
- </row>
-
- <row>
- <entry morerows="1" valign="top">rational</entry>
- <entry><code>Floatzh</code></entry>
- <entry>Float</entry>
- </row>
- <row>
- <entry><code>Doublezh</code></entry>
- <entry>Double</entry>
- </row>
-
- <row>
- <entry>character</entry>
- <entry><code>Charzh</code></entry>
- <entry>Unicode character specified by ASCII character</entry>
- </row>
-
- <row>
- <entry>string</entry>
- <entry><code>Addrzh</code></entry>
- <entry>Address of specified C-format string</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </section>
- </section>
-
-
- <bibliolist>
- <!-- This bibliography was semi-automatically converted by JabRef from core.bib. -->
-
- <title>References</title>
-
- <biblioentry>
- <abbrev>ghc-user-guide</abbrev>
- <authorgroup>
- <author><surname>The GHC Team</surname></author>
- </authorgroup>
- <citetitle pubwork="article">The Glorious Glasgow Haskell Compilation System User's Guide, Version 6.8.2</citetitle>
- <pubdate>2008</pubdate>
- <bibliomisc><ulink url="http://www.haskell.org/ghc/docs/latest/html/users_guide/index.html">http://www.haskell.org/ghc/docs/latest/html/users_guide/index.html</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>ghc-fc-commentary</abbrev>
- <authorgroup>
- <author><surname>GHC Wiki</surname></author>
- </authorgroup>
- <citetitle pubwork="article">System FC: equality constraints and coercions</citetitle>
- <pubdate>2006</pubdate>
- <bibliomisc><ulink url="http://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/FC">http://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/FC</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>ghc-api</abbrev>
- <authorgroup>
- <author><surname>Haskell Wiki</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Using GHC as a library</citetitle>
- <pubdate>2007</pubdate>
- <bibliomisc><ulink url="http://haskell.org/haskellwiki/GHC/As_a_library">http://haskell.org/haskellwiki/GHC/As_a_library</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>haskell98</abbrev>
- <authorgroup>
- <editor><firstname>Simon</firstname><surname>Peyton-Jones</surname></editor>
- </authorgroup>
- <citetitle pubwork="article">Haskell 98 Language and Libraries: The Revised Report</citetitle>
- <publisher>
- <publishername>Cambridge University Press</publishername>
- <address>
- <city>Cambridge></city>
- <state>UK</state>
- </address>
- </publisher>
- <pubdate>2003</pubdate>
- </biblioentry>
-
- <biblioentry>
- <abbrev>system-fc</abbrev>
- <authorgroup>
- <author><firstname>Martin</firstname><surname>Sulzmann</surname></author>
- <author><firstname>Manuel M.T.</firstname><surname>Chakravarty</surname></author>
- <author><firstname>Simon</firstname><surname>Peyton-Jones</surname></author>
- <author><firstname>Kevin</firstname><surname>Donnelly</surname></author>
- </authorgroup>
- <citetitle pubwork="article">System F with type equality coercions</citetitle>
- <publisher>
- <publishername>ACM</publishername>
- <address>
- <city>New York</city>
- <state>NY</state>
- <country>USA</country>
- </address>
- </publisher>
- <artpagenums>53-66</artpagenums>
- <pubdate>2007</pubdate>
- <bibliomisc><ulink url="http://portal.acm.org/citation.cfm?id=1190324">http://portal.acm.org/citation.cfm?id=1190324</ulink></bibliomisc>
- <!-- booktitle = {{TLDI '07: Proceedings of the 2007 ACM SIGPLAN International Workshop on Types in Language Design and Implementation}}, -->
- </biblioentry>
-
- <biblioentry>
- <abbrev>gadts</abbrev>
- <authorgroup>
- <author><firstname>Simon</firstname><surname>Peyton-Jones</surname></author>
- <author><firstname>Dimitrios</firstname><surname>Vytiniotis</surname></author>
- <author><firstname>Stephanie</firstname><surname>Weirich</surname></author>
- <author><firstname>Geoffrey</firstname><surname>Washburn</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Simple unification-based type inference for GADTs</citetitle>
- <publisher>
- <publishername>ACM</publishername>
- <address>
- <city>New York</city>
- <state>NY</state>
- <country>USA</country>
- </address>
- </publisher>
- <artpagenums>50-61</artpagenums>
- <pubdate>2006</pubdate>
- <bibliomisc><ulink url="http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm">http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>Launchbury94</abbrev>
- <authorgroup>
- <author><firstname>John</firstname><surname>Launchbury</surname></author>
- <author><firstname>Simon L.</firstname><surname>Peyton-Jones</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Lazy Functional State Threads</citetitle>
- <artpagenums>24-35</artpagenums>
- <pubdate>1994</pubdate>
- <bibliomisc><ulink url="http://citeseer.ist.psu.edu/article/launchbury93lazy.html">http://citeseer.ist.psu.edu/article/launchbury93lazy.html</ulink></bibliomisc>
- <!-- booktitle = "{SIGPLAN} {Conference} on {Programming Language Design and Implementation}", -->
- </biblioentry>
-
- <biblioentry>
- <abbrev>pj:unboxed</abbrev>
- <authorgroup>
- <author><firstname>Simon L.</firstname><surname>Peyton-Jones</surname></author>
- <author><firstname>John</firstname><surname>Launchbury</surname></author>
- <editor><firstname>J.</firstname><surname>Hughes</surname></editor>
- </authorgroup>
- <citetitle pubwork="article">Unboxed Values as First Class Citizens in a Non-strict Functional Language</citetitle>
- <publisher>
- <publishername>Springer-Verlag LNCS523</publishername>
- <address>
- <city>Cambridge</city>
- <state>Massachussetts</state>
- <country>USA</country>
- </address>
- </publisher>
- <artpagenums>636-666</artpagenums>
- <pubdate>1991, August 26-28</pubdate>
- <bibliomisc><ulink url="http://citeseer.ist.psu.edu/jones91unboxed.html">http://citeseer.ist.psu.edu/jones91unboxed.html</ulink></bibliomisc>
- <!-- booktitle = "Proceedings of the Conference on Functional Programming and Computer Architecture", -->
- </biblioentry>
-
- <biblioentry>
- <abbrev>ghc-inliner</abbrev>
- <authorgroup>
- <author><firstname>Simon</firstname><surname>Peyton-Jones</surname></author>
- <author><firstname>Simon</firstname><surname>Marlow</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Secrets of the Glasgow Haskell Compiler inliner</citetitle>
- <pubdate>1999</pubdate>
- <address>
- <city>Paris</city>
- <country>France</country>
- </address>
- <bibliomisc><ulink url="http://research.microsoft.com/Users/simonpj/Papers/inlining/inline.pdf">http://research.microsoft.com/Users/simonpj/Papers/inlining/inline.pdf</ulink></bibliomisc>
- <!-- booktitle = "Workshop on Implementing Declarative Languages", -->
- </biblioentry>
-
- <biblioentry>
- <abbrev>comp-by-trans-scp</abbrev>
- <authorgroup>
- <author><firstname>Simon L.</firstname><surname>Peyton-Jones</surname></author>
- <author><firstname>A. L. M.</firstname><surname>Santos</surname></author>
- </authorgroup>
- <citetitle pubwork="article">A transformation-based optimiser for Haskell</citetitle>
- <citetitle pubwork="journal">Science of Computer Programming</citetitle>
- <volumenum>32</volumenum>
- <issuenum>1-3</issuenum>
- <artpagenums>3-47</artpagenums>
- <pubdate>1998</pubdate>
- <bibliomisc><ulink url="http://citeseer.ist.psu.edu/peytonjones98transformationbased.html">http://citeseer.ist.psu.edu/peytonjones98transformationbased.html</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>stg-machine</abbrev>
- <authorgroup>
- <author><firstname>Simon L.</firstname><surname>Peyton-Jones</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine</citetitle>
- <citetitle pubwork="journal">Journal of Functional Programming</citetitle>
- <volumenum>2</volumenum>
- <issuenum>2</issuenum>
- <artpagenums>127-202</artpagenums>
- <pubdate>1992</pubdate>
- <bibliomisc><ulink url="http://citeseer.ist.psu.edu/peytonjones92implementing.html">http://citeseer.ist.psu.edu/peytonjones92implementing.html</ulink></bibliomisc>
- </biblioentry>
-
- <biblioentry>
- <abbrev>launchbury93natural</abbrev>
- <authorgroup>
- <author><firstname>John</firstname><surname>Launchbury</surname></author>
- </authorgroup>
- <citetitle pubwork="article">A Natural Semantics for Lazy Evaluation</citetitle>
- <artpagenums>144-154</artpagenums>
- <address>
- <city>Charleston</city>
- <state>South Carolina</state>
- </address>
- <pubdate>1993</pubdate>
- <bibliomisc><ulink url="http://citeseer.ist.psu.edu/launchbury93natural.html">http://citeseer.ist.psu.edu/launchbury93natural.html</ulink></bibliomisc>
- <!-- booktitle = "Conference Record of the Twentieth Annual {ACM} {SIGPLAN}-{SIGACT} Symposium on Principles of Programming Languages", -->
- </biblioentry>
-
- <biblioentry>
- <abbrev>ghcprim</abbrev>
- <authorgroup>
- <author><surname>The GHC Team</surname></author>
- </authorgroup>
- <citetitle pubwork="article">Library documentation: GHC.Prim</citetitle>
- <pubdate>2008</pubdate>
- <bibliomisc><ulink url="http://www.haskell.org/ghc/docs/latest/html/libraries/base/GHC-Prim.html">http://www.haskell.org/ghc/docs/latest/html/libraries/base/GHC-Prim.html</ulink></bibliomisc>
- </biblioentry>
- </bibliolist>
-
-</chapter>
diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml
index 593bf4b1ef..1dd224a611 100644
--- a/docs/users_guide/flags.xml
+++ b/docs/users_guide/flags.xml
@@ -705,6 +705,12 @@
</thead>
<tbody>
<row>
+ <entry><option>-fcontext-stack=N</option><replaceable>n</replaceable></entry>
+ <entry>set the <link linkend="undecidable-instances">limit for context reduction</link>. Default is 20.</entry>
+ <entry>dynamic</entry>
+ <entry></entry>
+ </row>
+ <row>
<entry><option>-fglasgow-exts</option></entry>
<entry>Deprecated. Enable most language extensions; see <xref linkend="options-language"/> for exactly which ones.</entry>
<entry>dynamic</entry>
@@ -717,10 +723,10 @@
<entry><option>-fno-irrefutable-tuples</option></entry>
</row>
<row>
- <entry><option>-fcontext-stack=N</option><replaceable>n</replaceable></entry>
- <entry>set the <link linkend="undecidable-instances">limit for context reduction</link>. Default is 20.</entry>
+ <entry><option>-fpackage-trust</option></entry>
+ <entry>Enable <link linkend="safe-haskell">Safe Haskell</link> trusted package requirement for trustworthy modules.</entry>
<entry>dynamic</entry>
- <entry></entry>
+ <entry><option>-</option></entry>
</row>
<row>
<entry><option>-ftype-function-depth=N</option><replaceable>n</replaceable></entry>
@@ -751,65 +757,168 @@
<entry><option>-XNoAutoDeriveTypeable</option></entry>
</row>
<row>
+ <entry><option>-XBangPatterns</option></entry>
+ <entry>Enable <link linkend="bang-patterns">bang patterns</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoBangPatterns</option></entry>
+ </row>
+ <row>
+ <entry><option>-XBinaryLiterals</option></entry>
+ <entry>Enable support for <link linkend="binary-literals">binary literals</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoBinaryLiterals</option></entry>
+ </row>
+ <row>
+ <entry><option>-XCApiFFI</option></entry>
+ <entry>Enable <link linkend="ffi-capi">the CAPI calling convention</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoCAPIFFI</option></entry>
+ </row>
+ <row>
+ <entry><option>-XConstrainedClassMethods</option></entry>
+ <entry>Enable <link linkend="class-method-types">constrained class methods</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoConstrainedClassMethods</option></entry>
+ </row>
+ <row>
<entry><option>-XConstraintKinds</option></entry>
<entry>Enable a <link linkend="constraint-kind">kind of constraints</link>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoConstraintKinds</option></entry>
</row>
<row>
+ <entry><option>-XCPP</option></entry>
+ <entry>Enable the <link linkend="c-pre-processor">C preprocessor</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoCPP</option></entry>
+ </row>
+ <row>
<entry><option>-XDataKinds</option></entry>
<entry>Enable <link linkend="promotion">datatype promotion</link>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoDataKinds</option></entry>
</row>
<row>
+ <entry><option>-XDefaultSignatures</option></entry>
+ <entry>Enable <link linkend="class-default-signatures">default signatures</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoDefaultSignatures</option></entry>
+ </row>
+ <row>
<entry><option>-XDeriveDataTypeable</option></entry>
- <entry>Enable <link linkend="deriving-typeable">deriving for the Data and Typeable classes</link>.</entry>
+ <entry>Enable <link linkend="deriving-typeable">deriving for the Data and Typeable classes</link>.
+ Implied by <option>-XAutoDeriveTypeable</option>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoDeriveDataTypeable</option></entry>
</row>
<row>
+ <entry><option>-XDeriveFunctor</option></entry>
+ <entry>Enable <link linkend="deriving-extra">deriving for the Functor class</link>.
+ Implied by <option>-XDeriveTraversable</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoDeriveFunctor</option></entry>
+ </row>
+ <row>
+ <entry><option>-XDeriveFoldable</option></entry>
+ <entry>Enable <link linkend="deriving-extra">deriving for the Foldable class</link>.
+ Implied by <option>-XDeriveTraversable</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoDeriveFoldable</option></entry>
+ </row>
+ <row>
<entry><option>-XDeriveGeneric</option></entry>
<entry>Enable <link linkend="deriving-typeable">deriving for the Generic class</link>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoDeriveGeneric</option></entry>
</row>
<row>
- <entry><option>-XGeneralizedNewtypeDeriving</option></entry>
- <entry>Enable <link linkend="newtype-deriving">newtype deriving</link>.</entry>
+ <entry><option>-XDeriveTraversable</option></entry>
+ <entry>Enable <link linkend="deriving-extra">deriving for the Traversable class</link>.
+ Implies <option>-XDeriveFunctor</option> and <option>-XDeriveFoldable</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoGeneralizedNewtypeDeriving</option></entry>
+ <entry><option>-XNoDeriveTraversable</option></entry>
</row>
<row>
<entry><option>-XDisambiguateRecordFields</option></entry>
- <entry>Enable <link linkend="disambiguate-fields">record
- field disambiguation</link></entry>
+ <entry>Enable <link linkend="disambiguate-fields">record field disambiguation</link>.
+ Implied by <option>-XRecordWildCards</option>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoDisambiguateRecordFields</option></entry>
</row>
<row>
<entry><option>-XEmptyCase</option></entry>
- <entry>Allow <link linkend="empty-case">empty case alternatives</link>
- </entry>
+ <entry>Allow <link linkend="empty-case">empty case alternatives</link>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoEmptyCase</option></entry>
</row>
<row>
+ <entry><option>-XEmptyDataDecls</option></entry>
+ <entry>Enable empty data declarations.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoEmptyDataDecls</option></entry>
+ </row>
+ <row>
+ <entry><option>-XExistentialQuantification</option></entry>
+ <entry>Enable <link linkend="existential-quantification">existential quantification</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoExistentialQuantification</option></entry>
+ </row>
+ <row>
+ <entry><option>-XExplicitForAll</option></entry>
+ <entry>Enable <link linkend="explicit-foralls">explicit universal quantification</link>.
+ Implied by <option>-XScopedTypeVariables</option>,
+ <option>-XLiberalTypeSynonyms</option>,
+ <option>-XRankNTypes</option> and
+ <option>-XExistentialQuantification</option>.
+ </entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoExplicitForAll</option></entry>
+ </row>
+ <row>
+ <entry><option>-XExplicitNamespaces</option></entry>
+ <entry>Enable using the keyword <literal>type</literal> to specify the namespace of
+ entries in imports and exports (<xref linkend="explicit-namespaces"/>).
+ Implied by <option>-XTypeOperators</option> and <option>-XTypeFamilies</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoExplicitNamespaces</option></entry>
+ </row>
+ <row>
<entry><option>-XExtendedDefaultRules</option></entry>
- <entry>Use GHCi's <link linkend="extended-default-rules">extended default rules</link> in a normal module</entry>
+ <entry>Use GHCi's <link linkend="extended-default-rules">extended default rules</link> in a normal module.</entry>
<entry>dynamic</entry>
<entry><option>-XNoExtendedDefaultRules</option></entry>
</row>
<row>
+ <entry><option>-XFlexibleContexts</option></entry>
+ <entry>Enable <link linkend="flexible-contexts">flexible contexts</link>.
+ Implied by <option>-XImplicitParams</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoFlexibleContexts</option></entry>
+ </row>
+ <row>
+ <entry><option>-XFlexibleInstances</option></entry>
+ <entry>Enable <link linkend="instance-rules">flexible instances</link>.
+ Implies <option>-XTypeSynonymInstances</option>. Implied by <option>-XImplicitParams</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoFlexibleInstances</option></entry>
+ </row>
+ <row>
<entry><option>-XForeignFunctionInterface</option></entry>
<entry>Enable <link linkend="ffi">foreign function interface</link>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoForeignFunctionInterface</option></entry>
</row>
<row>
+ <entry><option>-XFunctionalDependencies</option></entry>
+ <entry>Enable <link linkend="functional-dependencies">functional dependencies</link>.
+ Implies <option>-XMultiParamTypeClasses</option>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoFunctionalDependencies</option></entry>
+ </row>
+ <row>
<entry><option>-XGADTs</option></entry>
<entry>Enable <link linkend="gadt">generalised algebraic data types</link>.
- </entry>
+ Implies <option>-XGADTSyntax</option> and <option>-XMonoLocalBinds</option>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoGADTs</option></entry>
</row>
@@ -821,6 +930,12 @@
<entry><option>-XNoGADTSyntax</option></entry>
</row>
<row>
+ <entry><option>-XGeneralizedNewtypeDeriving</option></entry>
+ <entry>Enable <link linkend="newtype-deriving">newtype deriving</link>.</entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoGeneralizedNewtypeDeriving</option></entry>
+ </row>
+ <row>
<entry><option>-XGenerics</option></entry>
<entry>Deprecated, does nothing. No longer enables <link linkend="generic-classes">generic classes</link>.
See also GHC's support for
@@ -830,103 +945,74 @@
</row>
<row>
<entry><option>-XImplicitParams</option></entry>
- <entry>Enable <link linkend="implicit-parameters">Implicit Parameters</link>.</entry>
+ <entry>Enable <link linkend="implicit-parameters">Implicit Parameters</link>.
+ Implies <option>-XFlexibleContexts</option> and <option>-XFlexibleInstances</option>.</entry>
<entry>dynamic</entry>
<entry><option>-XNoImplicitParams</option></entry>
</row>
<row>
<entry><option>-XNoImplicitPrelude</option></entry>
- <entry>Don't implicitly <literal>import Prelude</literal></entry>
+ <entry>Don't implicitly <literal>import Prelude</literal>.
+ Implied by <option>-XRebindableSyntax</option>.</entry>
<entry>dynamic</entry>
<entry><option>-XImplicitPrelude</option></entry>
</row>
<row>
- <entry><option>-XIncoherentInstances</option></entry>
- <entry>Enable <link linkend="instance-overlap">incoherent instances</link>.
- Implies <option>-XOverlappingInstances</option> </entry>
- <entry>dynamic</entry>
- <entry><option>-XNoIncoherentInstances</option></entry>
- </row>
- <row>
- <entry><option>-XNoMonomorphismRestriction</option></entry>
- <entry>Disable the <link linkend="monomorphism">monomorphism restriction</link></entry>
- <entry>dynamic</entry>
- <entry><option>-XMonomorphismRrestriction</option></entry>
- </row>
- <row>
- <entry><option>-XNegativeLiterals</option></entry>
- <entry>Enable support for <link linkend="negative-literals">negative literals</link></entry>
- <entry>dynamic</entry>
- <entry><option>-XNoNegativeLiterals</option></entry>
- </row>
- <row>
- <entry><option>-XNoNPlusKPatterns</option></entry>
- <entry>Disable support for <literal>n+k</literal> patterns</entry>
- <entry>dynamic</entry>
- <entry><option>-XNPlusKPatterns</option></entry>
- </row>
- <row>
- <entry><option>-XNumDecimals</option></entry>
- <entry>Enable support for 'fractional' integer literals</entry>
- <entry>dynamic</entry>
- <entry><option>-XNoNumDecimals</option></entry>
- </row>
- <row>
- <entry><option>-XOverlappingInstances</option></entry>
- <entry>Enable <link linkend="instance-overlap">overlapping instances</link></entry>
+ <entry><option>-XImpredicativeTypes</option></entry>
+ <entry>Enable <link linkend="impredicative-polymorphism">impredicative types</link>.
+ Implies <option>-XRankNTypes</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoOverlappingInstances</option></entry>
+ <entry><option>-XNoImpredicativeTypes</option></entry>
</row>
<row>
- <entry><option>-XOverloadedLists</option></entry>
- <entry>Enable <link linkend="overloaded-lists">overloaded lists</link>.
- </entry>
+ <entry><option>-XIncoherentInstances</option></entry>
+ <entry>Enable <link linkend="instance-overlap">incoherent instances</link>.
+ Implies <option>-XOverlappingInstances</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoOverloadedLists</option></entry>
+ <entry><option>-XNoIncoherentInstances</option></entry>
</row>
<row>
- <entry><option>-XOverloadedStrings</option></entry>
- <entry>Enable <link linkend="overloaded-strings">overloaded string literals</link>.
- </entry>
+ <entry><option>-XInstanceSigs</option></entry>
+ <entry>Enable <link linkend="instance-sigs">instance signatures</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoOverloadedStrings</option></entry>
+ <entry><option>-XNoInstanceSigs</option></entry>
</row>
<row>
- <entry><option>-XQuasiQuotes</option></entry>
- <entry>Enable <link linkend="th-quasiquotation">quasiquotation</link>.</entry>
+ <entry><option>-XInterruptibleFFI</option></entry>
+ <entry>Enable interruptible FFI.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoQuasiQuotes</option></entry>
+ <entry><option>-XNoInterruptibleFFI</option></entry>
</row>
<row>
- <entry><option>-XRelaxedPolyRec</option></entry>
- <entry>Relaxed checking for <link linkend="typing-binds">mutually-recursive polymorphic functions</link></entry>
+ <entry><option>-XKindSignatures</option></entry>
+ <entry>Enable <link linkend="kinding">kind signatures</link>.
+ Implied by <option>-XTypeFamilies</option> and <option>-XPolyKinds</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoRelaxedPolyRec</option></entry>
+ <entry><option>-XNoKindSignatures</option></entry>
</row>
<row>
- <entry><option>-XNoTraditionalRecordSyntax</option></entry>
- <entry>Disable support for traditional record syntax (as supported by Haskell 98) <literal>C {f = x}</literal></entry>
+ <entry><option>-XLambdaCase</option></entry>
+ <entry>Enable <link linkend="lambda-case">lambda-case expressions</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XTraditionalRecordSyntax</option></entry>
+ <entry><option>-XNoLambdaCase</option></entry>
</row>
<row>
- <entry><option>-XTypeFamilies</option></entry>
- <entry>Enable <link linkend="type-families">type families</link>.</entry>
+ <entry><option>-XLiberalTypeSynonyms</option></entry>
+ <entry>Enable <link linkend="type-synonyms">liberalised type synonyms</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoTypeFamilies</option></entry>
+ <entry><option>-XNoLiberalTypeSynonyms</option></entry>
</row>
<row>
- <entry><option>-XUndecidableInstances</option></entry>
- <entry>Enable <link linkend="undecidable-instances">undecidable instances</link></entry>
+ <entry><option>-XMagicHash</option></entry>
+ <entry>Allow "#" as a <link linkend="magic-hash">postfix modifier on identifiers</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoUndecidableInstances</option></entry>
+ <entry><option>-XNoMagicHash</option></entry>
</row>
<row>
- <entry><option>-XPolyKinds</option></entry>
- <entry>Enable <link linkend="kind-polymorphism">kind polymorphism</link>.
- Implies <option>-XKindSignatures</option>.</entry>
+ <entry><option>-XMonadComprehensions</option></entry>
+ <entry>Enable <link linkend="monad-comprehensions">monad comprehensions</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoPolyKinds</option></entry>
+ <entry><option>-XNoMonadComprehensions</option></entry>
</row>
<row>
<entry><option>-XMonoLocalBinds</option></entry>
@@ -935,164 +1021,159 @@
</entry>
<entry>dynamic</entry>
<entry><option>-XNoMonoLocalBinds</option></entry>
- </row>
+ </row>
<row>
- <entry><option>-XRebindableSyntax</option></entry>
- <entry>Employ <link linkend="rebindable-syntax">rebindable syntax</link></entry>
+ <entry><option>-XNoMonomorphismRestriction</option></entry>
+ <entry>Disable the <link linkend="monomorphism">monomorphism restriction</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoRebindableSyntax</option></entry>
+ <entry><option>-XMonomorphismRrestriction</option></entry>
</row>
<row>
- <entry><option>-XScopedTypeVariables</option></entry>
- <entry>Enable <link linkend="scoped-type-variables">lexically-scoped type variables</link>.
- </entry>
+ <entry><option>-XMultiParamTypeClasses</option></entry>
+ <entry>Enable <link linkend="multi-param-type-classes">multi parameter type classes</link>.
+ Implied by <option>-XFunctionalDependencies</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoScopedTypeVariables</option></entry>
+ <entry><option>-XNoMultiParamTypeClasses</option></entry>
</row>
<row>
- <entry><option>-XTemplateHaskell</option></entry>
- <entry>Enable <link linkend="template-haskell">Template Haskell</link>.</entry>
+ <entry><option>-XMultiWayIf</option></entry>
+ <entry>Enable <link linkend="multi-way-if">multi-way if-expressions</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoTemplateHaskell</option></entry>
+ <entry><option>-XNoMultiWayIf</option></entry>
</row>
<row>
- <entry><option>-XBangPatterns</option></entry>
- <entry>Enable <link linkend="bang-patterns">bang patterns</link>.</entry>
+ <entry><option>-XNamedFieldPuns</option></entry>
+ <entry>Enable <link linkend="record-puns">record puns</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoBangPatterns</option></entry>
+ <entry><option>-XNoNamedFieldPuns</option></entry>
</row>
<row>
- <entry><option>-XCPP</option></entry>
- <entry>Enable the <link linkend="c-pre-processor">C preprocessor</link>.</entry>
+ <entry><option>-XNegativeLiterals</option></entry>
+ <entry>Enable support for <link linkend="negative-literals">negative literals</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoCPP</option></entry>
+ <entry><option>-XNoNegativeLiterals</option></entry>
</row>
<row>
- <entry><option>-XPatternGuards</option></entry>
- <entry>Enable <link linkend="pattern-guards">pattern guards</link>.</entry>
+ <entry><option>-XNoNPlusKPatterns</option></entry>
+ <entry>Disable support for <literal>n+k</literal> patterns.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoPatternGuards</option></entry>
+ <entry><option>-XNPlusKPatterns</option></entry>
</row>
<row>
- <entry><option>-XViewPatterns</option></entry>
- <entry>Enable <link linkend="view-patterns">view patterns</link>.</entry>
+ <entry><option>-XNullaryTypeClasses</option></entry>
+ <entry>Deprecated, does nothing. <link linkend="nullary-type-classes">nullary (no parameter) type classes</link> are now enabled using <option>-XMultiParamTypeClasses</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoViewPatterns</option></entry>
+ <entry><option>-XNoNullaryTypeClasses</option></entry>
</row>
<row>
- <entry><option>-XUnicodeSyntax</option></entry>
- <entry>Enable <link linkend="unicode-syntax">unicode syntax</link>.</entry>
+ <entry><option>-XNumDecimals</option></entry>
+ <entry>Enable support for 'fractional' integer literals.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoUnicodeSyntax</option></entry>
+ <entry><option>-XNoNumDecimals</option></entry>
</row>
<row>
- <entry><option>-XMagicHash</option></entry>
- <entry>Allow "#" as a <link linkend="magic-hash">postfix modifier on identifiers</link>.</entry>
+ <entry><option>-XOverlappingInstances</option></entry>
+ <entry>Enable <link linkend="instance-overlap">overlapping instances</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoMagicHash</option></entry>
+ <entry><option>-XNoOverlappingInstances</option></entry>
</row>
<row>
- <entry><option>-XExplicitForAll</option></entry>
- <entry>Enable <link linkend="explicit-foralls">explicit universal quantification</link>.
- Implied by <option>-XScopedTypeVariables</option>,
- <option>-XLiberalTypeSynonyms</option>,
- <option>-XRankNTypes</option>,
- <option>-XExistentialQuantification</option>
+ <entry><option>-XOverloadedLists</option></entry>
+ <entry>Enable <link linkend="overloaded-lists">overloaded lists</link>.
</entry>
<entry>dynamic</entry>
- <entry><option>-XNoExplicitForAll</option></entry>
- </row>
- <row>
- <entry><option>-XPolymorphicComponents</option></entry>
- <entry>Enable <link linkend="universal-quantification">polymorphic components for data constructors</link>.</entry>
- <entry>dynamic, synonym for <option>-XRankNTypes</option></entry>
- <entry><option>-XNoPolymorphicComponents</option></entry>
+ <entry><option>-XNoOverloadedLists</option></entry>
</row>
<row>
- <entry><option>-XRank2Types</option></entry>
- <entry>Enable <link linkend="universal-quantification">rank-2 types</link>.</entry>
- <entry>dynamic, synonym for <option>-XRankNTypes</option></entry>
- <entry><option>-XNoRank2Types</option></entry>
+ <entry><option>-XOverloadedStrings</option></entry>
+ <entry>Enable <link linkend="overloaded-strings">overloaded string literals</link>.
+ </entry>
+ <entry>dynamic</entry>
+ <entry><option>-XNoOverloadedStrings</option></entry>
</row>
<row>
- <entry><option>-XRankNTypes</option></entry>
- <entry>Enable <link linkend="universal-quantification">rank-N types</link>.</entry>
+ <entry><option>-XPackageImports</option></entry>
+ <entry>Enable <link linkend="package-imports">package-qualified imports</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoRankNTypes</option></entry>
+ <entry><option>-XNoPackageImports</option></entry>
</row>
<row>
- <entry><option>-XImpredicativeTypes</option></entry>
- <entry>Enable <link linkend="impredicative-polymorphism">impredicative types</link>.</entry>
+ <entry><option>-XParallelArrays</option></entry>
+ <entry>Enable parallel arrays.
+ Implies <option>-XParallelListComp</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoImpredicativeTypes</option></entry>
+ <entry><option>-XNoParallelArrays</option></entry>
</row>
<row>
- <entry><option>-XExistentialQuantification</option></entry>
- <entry>Enable <link linkend="existential-quantification">existential quantification</link>.</entry>
+ <entry><option>-XParallelListComp</option></entry>
+ <entry>Enable <link linkend="parallel-list-comprehensions">parallel list comprehensions</link>.
+ Implied by <option>-XParallelArrays</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoExistentialQuantification</option></entry>
+ <entry><option>-XNoParallelListComp</option></entry>
</row>
<row>
- <entry><option>-XKindSignatures</option></entry>
- <entry>Enable <link linkend="kinding">kind signatures</link>.</entry>
+ <entry><option>-XPatternGuards</option></entry>
+ <entry>Enable <link linkend="pattern-guards">pattern guards</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoKindSignatures</option></entry>
+ <entry><option>-XNoPatternGuards</option></entry>
</row>
<row>
- <entry><option>-XEmptyDataDecls</option></entry>
- <entry>Enable empty data declarations.</entry>
+ <entry><option>-XPatternSynonyms</option></entry>
+ <entry>Enable <link linkend="pattern-synonyms">pattern synonyms</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoEmptyDataDecls</option></entry>
+ <entry><option>-XNoPatternSynonyms</option></entry>
</row>
<row>
- <entry><option>-XParallelListComp</option></entry>
- <entry>Enable <link linkend="parallel-list-comprehensions">parallel list comprehensions</link>.</entry>
+ <entry><option>-XPolyKinds</option></entry>
+ <entry>Enable <link linkend="kind-polymorphism">kind polymorphism</link>.
+ Implies <option>-XKindSignatures</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoParallelListComp</option></entry>
+ <entry><option>-XNoPolyKinds</option></entry>
</row>
<row>
- <entry><option>-XTransformListComp</option></entry>
- <entry>Enable <link linkend="generalised-list-comprehensions">generalised list comprehensions</link>.</entry>
- <entry>dynamic</entry>
- <entry><option>-XNoTransformListComp</option></entry>
+ <entry><option>-XPolymorphicComponents</option></entry>
+ <entry>Enable <link linkend="universal-quantification">polymorphic components for data constructors</link>.</entry>
+ <entry>dynamic, synonym for <option>-XRankNTypes</option></entry>
+ <entry><option>-XNoPolymorphicComponents</option></entry>
</row>
<row>
- <entry><option>-XMonadComprehensions</option></entry>
- <entry>Enable <link linkend="monad-comprehensions">monad comprehensions</link>.</entry>
+ <entry><option>-XPostfixOperators</option></entry>
+ <entry>Enable <link linkend="postfix-operators">postfix operators</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoMonadComprehensions</option></entry>
+ <entry><option>-XNoPostfixOperators</option></entry>
</row>
<row>
- <entry><option>-XUnliftedFFITypes</option></entry>
- <entry>Enable unlifted FFI types.</entry>
+ <entry><option>-XQuasiQuotes</option></entry>
+ <entry>Enable <link linkend="th-quasiquotation">quasiquotation</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoUnliftedFFITypes</option></entry>
+ <entry><option>-XNoQuasiQuotes</option></entry>
</row>
<row>
- <entry><option>-XInterruptibleFFI</option></entry>
- <entry>Enable interruptible FFI.</entry>
- <entry>dynamic</entry>
- <entry><option>-XNoInterruptibleFFI</option></entry>
+ <entry><option>-XRank2Types</option></entry>
+ <entry>Enable <link linkend="universal-quantification">rank-2 types</link>.</entry>
+ <entry>dynamic, synonym for <option>-XRankNTypes</option></entry>
+ <entry><option>-XNoRank2Types</option></entry>
</row>
<row>
- <entry><option>-XLiberalTypeSynonyms</option></entry>
- <entry>Enable <link linkend="type-synonyms">liberalised type synonyms</link>.</entry>
+ <entry><option>-XRankNTypes</option></entry>
+ <entry>Enable <link linkend="universal-quantification">rank-N types</link>.
+ Implied by <option>-XImpredicativeTypes</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoLiberalTypeSynonyms</option></entry>
+ <entry><option>-XNoRankNTypes</option></entry>
</row>
<row>
- <entry><option>-XTypeOperators</option></entry>
- <entry>Enable <link linkend="type-operators">type operators</link>.</entry>
+ <entry><option>-XRebindableSyntax</option></entry>
+ <entry>Employ <link linkend="rebindable-syntax">rebindable syntax</link>.
+ Implies <option>-XNoImplicitPrelude</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoTypeOperators</option></entry>
+ <entry><option>-XNoRebindableSyntax</option></entry>
</row>
<row>
- <entry><option>-XExplicitNamespaces</option></entry>
- <entry>Enable using the keyword <literal>type</literal> to specify the namespace of
- entries in imports and exports (<xref linkend="explicit-namespaces"/>).
- Implied by <option>-XTypeOperators</option> and <option>-XTypeFamilies</option>.</entry>
+ <entry><option>-XRecordWildCards</option></entry>
+ <entry>Enable <link linkend="record-wildcards">record wildcards</link>.
+ Implies <option>-XDisambiguateRecordFields</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoExplicitNamespaces</option></entry>
+ <entry><option>-XNoRecordWildCards</option></entry>
</row>
<row>
<entry><option>-XRecursiveDo</option></entry>
@@ -1101,34 +1182,30 @@
<entry><option>-XNoRecursiveDo</option></entry>
</row>
<row>
- <entry><option>-XParallelArrays</option></entry>
- <entry>Enable parallel arrays.</entry>
- <entry>dynamic</entry>
- <entry><option>-XNoParallelArrays</option></entry>
- </row>
- <row>
- <entry><option>-XRecordWildCards</option></entry>
- <entry>Enable <link linkend="record-wildcards">record wildcards</link>.</entry>
+ <entry><option>-XRelaxedPolyRec</option></entry>
+ <entry><emphasis>(deprecated)</emphasis> Relaxed checking for
+ <link linkend="typing-binds">mutually-recursive polymorphic functions</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoRecordWildCards</option></entry>
+ <entry><option>-XNoRelaxedPolyRec</option></entry>
</row>
<row>
- <entry><option>-XNamedFieldPuns</option></entry>
- <entry>Enable <link linkend="record-puns">record puns</link>.</entry>
+ <entry><option>-XRoleAnnotations</option></entry>
+ <entry>Enable <link linkend="role-annotations">role annotations</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoNamedFieldPuns</option></entry>
+ <entry><option>-XNoRoleAnnotations</option></entry>
</row>
<row>
- <entry><option>-XDisambiguateRecordFields</option></entry>
- <entry>Enable <link linkend="disambiguate-fields">record field disambiguation</link>. </entry>
+ <entry><option>-XSafe</option></entry>
+ <entry>Enable the <link linkend="safe-haskell">Safe Haskell</link> Safe mode.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoDisambiguateRecordFields</option></entry>
+ <entry><option>-</option></entry>
</row>
<row>
- <entry><option>-XUnboxedTuples</option></entry>
- <entry>Enable <link linkend="unboxed-tuples">unboxed tuples</link>.</entry>
+ <entry><option>-XScopedTypeVariables</option></entry>
+ <entry>Enable <link linkend="scoped-type-variables">lexically-scoped type variables</link>.
+ </entry>
<entry>dynamic</entry>
- <entry><option>-XNoUnboxedTuples</option></entry>
+ <entry><option>-XNoScopedTypeVariables</option></entry>
</row>
<row>
<entry><option>-XStandaloneDeriving</option></entry>
@@ -1137,83 +1214,80 @@
<entry><option>-XNoStandaloneDeriving</option></entry>
</row>
<row>
- <entry><option>-XTypeSynonymInstances</option></entry>
- <entry>Enable <link linkend="flexible-instance-head">type synonyms in instance heads</link>.</entry>
- <entry>dynamic</entry>
- <entry><option>-XNoTypeSynonymInstances</option></entry>
- </row>
- <row>
- <entry><option>-XFlexibleContexts</option></entry>
- <entry>Enable <link linkend="flexible-contexts">flexible contexts</link>.</entry>
+ <entry><option>-XTemplateHaskell</option></entry>
+ <entry>Enable <link linkend="template-haskell">Template Haskell</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoFlexibleContexts</option></entry>
+ <entry><option>-XNoTemplateHaskell</option></entry>
</row>
<row>
- <entry><option>-XFlexibleInstances</option></entry>
- <entry>Enable <link linkend="instance-rules">flexible instances</link>.
- Implies <option>-XTypeSynonymInstances</option> </entry>
+ <entry><option>-XNoTraditionalRecordSyntax</option></entry>
+ <entry>Disable support for traditional record syntax (as supported by Haskell 98) <literal>C {f = x}</literal></entry>
<entry>dynamic</entry>
- <entry><option>-XNoFlexibleInstances</option></entry>
+ <entry><option>-XTraditionalRecordSyntax</option></entry>
</row>
<row>
- <entry><option>-XConstrainedClassMethods</option></entry>
- <entry>Enable <link linkend="class-method-types">constrained class methods</link>.</entry>
+ <entry><option>-XTransformListComp</option></entry>
+ <entry>Enable <link linkend="generalised-list-comprehensions">generalised list comprehensions</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoConstrainedClassMethods</option></entry>
+ <entry><option>-XNoTransformListComp</option></entry>
</row>
<row>
- <entry><option>-XDefaultSignatures</option></entry>
- <entry>Enable <link linkend="class-default-signatures">default signatures</link>.</entry>
+ <entry><option>-XTrustworthy</option></entry>
+ <entry>Enable the <link linkend="safe-haskell">Safe Haskell</link> Trustworthy mode.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoDefaultSignatures</option></entry>
+ <entry><option>-</option></entry>
</row>
<row>
- <entry><option>-XMultiParamTypeClasses</option></entry>
- <entry>Enable <link linkend="multi-param-type-classes">multi parameter type classes</link>.</entry>
+ <entry><option>-XTupleSections</option></entry>
+ <entry>Enable <link linkend="tuple-sections">tuple sections</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoMultiParamTypeClasses</option></entry>
+ <entry><option>-XNoTupleSections</option></entry>
</row>
<row>
- <entry><option>-XNullaryTypeClasses</option></entry>
- <entry>Enable <link linkend="nullary-type-classes">nullary (no parameter) type classes</link>.</entry>
+ <entry><option>-XTypeFamilies</option></entry>
+ <entry>Enable <link linkend="type-families">type families</link>.
+ Implies <option>-XExplicitNamespaces</option>, <option>-XKindSignatures</option>
+ and <option>-XMonoLocalBinds</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoNullaryTypeClasses</option></entry>
+ <entry><option>-XNoTypeFamilies</option></entry>
</row>
<row>
- <entry><option>-XFunctionalDependencies</option></entry>
- <entry>Enable <link linkend="functional-dependencies">functional dependencies</link>.</entry>
+ <entry><option>-XTypeOperators</option></entry>
+ <entry>Enable <link linkend="type-operators">type operators</link>.
+ Implies <option>-XExplicitNamespaces</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoFunctionalDependencies</option></entry>
+ <entry><option>-XNoTypeOperators</option></entry>
</row>
<row>
- <entry><option>-XPackageImports</option></entry>
- <entry>Enable <link linkend="package-imports">package-qualified imports</link>.</entry>
+ <entry><option>-XTypeSynonymInstances</option></entry>
+ <entry>Enable <link linkend="flexible-instance-head">type synonyms in instance heads</link>.
+ Implied by <option>-XFlexibleInstances</option>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoPackageImports</option></entry>
+ <entry><option>-XNoTypeSynonymInstances</option></entry>
</row>
<row>
- <entry><option>-XLambdaCase</option></entry>
- <entry>Enable <link linkend="lambda-case">lambda-case expressions</link>.</entry>
+ <entry><option>-XUnboxedTuples</option></entry>
+ <entry>Enable <link linkend="unboxed-tuples">unboxed tuples</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoLambdaCase</option></entry>
+ <entry><option>-XNoUnboxedTuples</option></entry>
</row>
<row>
- <entry><option>-XMultiWayIf</option></entry>
- <entry>Enable <link linkend="multi-way-if">multi-way if-expressions</link>.</entry>
+ <entry><option>-XUndecidableInstances</option></entry>
+ <entry>Enable <link linkend="undecidable-instances">undecidable instances</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-XNoMultiWayIf</option></entry>
+ <entry><option>-XNoUndecidableInstances</option></entry>
</row>
<row>
- <entry><option>-XSafe</option></entry>
- <entry>Enable the <link linkend="safe-haskell">Safe Haskell</link> Safe mode.</entry>
+ <entry><option>-XUnicodeSyntax</option></entry>
+ <entry>Enable <link linkend="unicode-syntax">unicode syntax</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-</option></entry>
+ <entry><option>-XNoUnicodeSyntax</option></entry>
</row>
<row>
- <entry><option>-XTrustworthy</option></entry>
- <entry>Enable the <link linkend="safe-haskell">Safe Haskell</link> Trustworthy mode.</entry>
+ <entry><option>-XUnliftedFFITypes</option></entry>
+ <entry>Enable unlifted FFI types.</entry>
<entry>dynamic</entry>
- <entry><option>-</option></entry>
+ <entry><option>-XNoUnliftedFFITypes</option></entry>
</row>
<row>
<entry><option>-XUnsafe</option></entry>
@@ -1222,10 +1296,10 @@
<entry><option>-</option></entry>
</row>
<row>
- <entry><option>-fpackage-trust</option></entry>
- <entry>Enable <link linkend="safe-haskell">Safe Haskell</link> trusted package requirement for trustworthy modules.</entry>
+ <entry><option>-XViewPatterns</option></entry>
+ <entry>Enable <link linkend="view-patterns">view patterns</link>.</entry>
<entry>dynamic</entry>
- <entry><option>-</option></entry>
+ <entry><option>-XNoViewPatterns</option></entry>
</row>
</tbody>
</tgroup>
@@ -2141,6 +2215,12 @@
<entry>-</entry>
</row>
<row>
+ <entry><option>-fwrite-interface</option></entry>
+ <entry>Always write interface files</entry>
+ <entry>dynamic</entry>
+ <entry>-</entry>
+ </row>
+ <row>
<entry><option>-fbyte-code</option></entry>
<entry>Generate byte-code</entry>
<entry>dynamic</entry>
@@ -2607,34 +2687,6 @@
<sect2>
- <title>External core file options</title>
-
- <para><xref linkend="ext-core"/></para>
-
- <informaltable>
- <tgroup cols="4" align="left" colsep="1" rowsep="1">
- <thead>
- <row>
- <entry>Flag</entry>
- <entry>Description</entry>
- <entry>Static/Dynamic</entry>
- <entry>Reverse</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><option>-fext-core</option></entry>
- <entry>Generate <filename>.hcr</filename> external Core files</entry>
- <entry>dynamic</entry>
- <entry>-</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </sect2>
-
-
- <sect2>
<title>Compiler debugging options</title>
<para><xref linkend="options-debugging"/></para>
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index 912ecb25ce..729f96f244 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -2432,7 +2432,9 @@ Prelude> :. cmds.ghci
<listitem>
<para>Opens an editor to edit the file
<replaceable>file</replaceable>, or the most recently loaded
- module if <replaceable>file</replaceable> is omitted. The
+ module if <replaceable>file</replaceable> is omitted.
+ If there were errors during the last loading,
+ the cursor will be positioned at the line of the first error. The
editor to invoke is taken from the <literal>EDITOR</literal>
environment variable, or a default editor on your system if
<literal>EDITOR</literal> is not set. You can change the
@@ -3294,12 +3296,38 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
<title>Setting options for interactive evaluation only</title>
<para>
- GHCi actually maintains two sets of options: one set that
- applies when loading modules, and another set that applies for
- expressions and commands typed at the prompt. The
- <literal>:set</literal> command modifies both, but there is
+ GHCi actually maintains <emphasis>two</emphasis> sets of options:
+<itemizedlist>
+<listitem><para>
+ The <emphasis>loading options</emphasis> apply when loading modules
+</para></listitem>
+<listitem><para>
+ The <emphasis>interactive options</emphasis> apply when evaluating expressions and commands typed at the GHCi prompt.
+</para></listitem>
+</itemizedlist>
+The <literal>:set</literal> command modifies both, but there is
also a <literal>:seti</literal> command (for "set
- interactive") that affects only the second set.
+ interactive") that affects only the interactive options set.
+ </para>
+
+ <para>
+ It is often useful to change the interactive options,
+ without having that option apply to loaded modules
+ too. For example
+<screen>
+:seti -XMonoLocalBinds
+</screen>
+ It would be undesirable if <option>-XMonoLocalBinds</option> were to
+ apply to loaded modules too: that might cause a compilation error, but
+ more commonly it will cause extra recompilation, because GHC will think
+ that it needs to recompile the module because the flags have changed.
+ </para>
+
+ <para>
+ If you are setting language options in your <literal>.ghci</literal> file, it is good practice
+ to use <literal>:seti</literal> rather than <literal>:set</literal>,
+ unless you really do want them to apply to all modules you
+ load in GHCi.
</para>
<para>
@@ -3307,8 +3335,6 @@ Prelude> :set -fno-warn-incomplete-patterns -XNoMultiParamTypeClasses
<literal>:set</literal> and <literal>:seti</literal> commands
respectively, with no arguments. For example, in a clean GHCi
session we might see something like this:
- </para>
-
<screen>
Prelude> :seti
base language is: Haskell2010
@@ -3322,38 +3348,24 @@ other dynamic, non-language, flag settings:
-fimplicit-import-qualified
warning settings:
</screen>
- <para>
- Note that the option <option>-XExtendedDefaultRules</option>
- is on, because we apply special defaulting rules to
+ </para>
+<para>
+The two sets of options are initialised as follows. First, both sets of options
+are initialised as described in <xref linkend="ghci-dot-files"/>.
+Then the interactive options are modified as follows:
+<itemizedlist>
+<listitem><para>
+ The option <option>-XExtendedDefaultRules</option>
+ is enabled, in order to apply special defaulting rules to
expressions typed at the prompt (see <xref
linkend="extended-default-rules" />).
- </para>
-
- <para>
- Furthermore, the Monomorphism Restriction is disabled by default in
- GHCi (see <xref linkend="monomorphism" />).
- </para>
-
- <para>
- It is often useful to change the language options for expressions typed
- at the prompt only, without having that option apply to loaded modules
- too. For example
-<screen>
-:seti -XMonoLocalBinds
-</screen>
- It would be undesirable if <option>-XMonoLocalBinds</option> were to
- apply to loaded modules too: that might cause a compilation error, but
- more commonly it will cause extra recompilation, because GHC will think
- that it needs to recompile the module because the flags have changed.
- </para>
+ </para></listitem>
- <para>
- It is therefore good practice if you are setting language
- options in your <literal>.ghci</literal> file, to use
- <literal>:seti</literal> rather than <literal>:set</literal>
- unless you really do want them to apply to all modules you
- load in GHCi.
- </para>
+<listitem> <para>
+ The Monomorphism Restriction is disabled (see <xref linkend="monomorphism" />).
+ </para></listitem>
+</itemizedlist>
+</para>
</sect2>
</sect1>
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index acc796371a..9acb56fc29 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -480,6 +480,26 @@ Indeed, the bindings can even be recursive.
</para>
</sect2>
+ <sect2 id="binary-literals">
+ <title>Binary integer literals</title>
+ <para>
+ Haskell 2010 and Haskell 98 allows for integer literals to
+ be given in decimal, octal (prefixed by
+ <literal>0o</literal> or <literal>0O</literal>), or
+ hexadecimal notation (prefixed by <literal>0x</literal> or
+ <literal>0X</literal>).
+ </para>
+
+ <para>
+ The language extension <option>-XBinaryLiterals</option>
+ adds support for expressing integer literals in binary
+ notation with the prefix <literal>0b</literal> or
+ <literal>0B</literal>. For instance, the binary integer
+ literal <literal>0b11001001</literal> will be desugared into
+ <literal>fromInteger 201</literal> when
+ <option>-XBinaryLiterals</option> is enabled.
+ </para>
+ </sect2>
<!-- ====================== HIERARCHICAL MODULES ======================= -->
@@ -971,25 +991,27 @@ right-hand side.
</para>
<para>
-The semantics of a unidirectional pattern synonym declaration and
-usage are as follows:
-
-<itemizedlist>
+The syntax and semantics of pattern synonyms are elaborated in the
+following subsections.
+See the <ulink
+url="http://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms">Wiki
+page</ulink> for more details.
+</para>
-<listitem> Syntax:
+<sect3> <title>Syntax and scoping of pattern synonyms</title>
<para>
A pattern synonym declaration can be either unidirectional or
bidirectional. The syntax for unidirectional pattern synonyms is:
-</para>
<programlisting>
pattern Name args &lt;- pat
</programlisting>
-<para>
and the syntax for bidirectional pattern synonyms is:
-</para>
<programlisting>
pattern Name args = pat
</programlisting>
+ Either prefix or infix syntax can be
+ used.
+</para>
<para>
Pattern synonym declarations can only occur in the top level of a
module. In particular, they are not allowed as local
@@ -997,20 +1019,6 @@ bidirectional. The syntax for unidirectional pattern synonyms is:
technical restriction that will be lifted in later versions.
</para>
<para>
- The name of the pattern synonym itself is in the same namespace as
- proper data constructors. Either prefix or infix syntax can be
- used. In export/import specifications, you have to prefix pattern
- names with the <literal>pattern</literal> keyword, e.g.:
-</para>
-<programlisting>
- module Example (pattern Single) where
- pattern Single x = [x]
-</programlisting>
-</listitem>
-
-<listitem> Scoping:
-
-<para>
The variables in the left-hand side of the definition are bound by
the pattern on the right-hand side. For bidirectional pattern
synonyms, all the variables of the right-hand side must also occur
@@ -1022,10 +1030,35 @@ bidirectional. The syntax for unidirectional pattern synonyms is:
<para>
Pattern synonyms cannot be defined recursively.
</para>
+</sect3>
-</listitem>
+<sect3 id="patsyn-impexp"> <title>Import and export of pattern synonyms</title>
+
+<para>
+ The name of the pattern synonym itself is in the same namespace as
+ proper data constructors. In an export or import specification,
+ you must prefix pattern
+ names with the <literal>pattern</literal> keyword, e.g.:
+<programlisting>
+ module Example (pattern Single) where
+ pattern Single x = [x]
+</programlisting>
+Without the <literal>pattern</literal> prefix, <literal>Single</literal> would
+be interpreted as a type constructor in the export list.
+</para>
+<para>
+You may also use the <literal>pattern</literal> keyword in an import/export
+specification to import or export an ordinary data constructor. For example:
+<programlisting>
+ import Data.Maybe( pattern Just )
+</programlisting>
+would bring into scope the data constructor <literal>Just</literal> from the
+<literal>Maybe</literal> type, without also bringing the type constructor
+<literal>Maybe</literal> into scope.
+</para>
+</sect3>
-<listitem> Typing:
+<sect3> <title>Typing of pattern synonyms</title>
<para>
Given a pattern synonym definition of the form
@@ -1100,10 +1133,9 @@ pattern (Show b) => ExNumPat b :: (Num a, Eq a) => T a
<programlisting>
ExNumPat :: (Show b, Num a, Eq a) => b -> T t
</programlisting>
+</sect3>
-</listitem>
-
-<listitem> Matching:
+<sect3><title>Matching of pattern synonyms</title>
<para>
A pattern synonym occurrence in a pattern is evaluated by first
@@ -1125,8 +1157,6 @@ f' _ = False
<para>
Note that the strictness of <literal>f</literal> differs from that
of <literal>g</literal> defined below:
-</para>
-
<programlisting>
g [True, True] = True
g _ = False
@@ -1136,9 +1166,8 @@ g _ = False
*Main> g (False:undefined)
False
</programlisting>
-</listitem>
-</itemizedlist>
</para>
+</sect3>
</sect2>
@@ -1883,7 +1912,8 @@ the comprehension being over an arbitrary monad.
functions <literal>(>>=)</literal>,
<literal>(>>)</literal>, and <literal>fail</literal>,
are in scope (not the Prelude
- versions). List comprehensions, mdo (<xref linkend="recursive-do-notation"/>), and parallel array
+ versions). List comprehensions, <literal>mdo</literal>
+ (<xref linkend="recursive-do-notation"/>), and parallel array
comprehensions, are unaffected. </para></listitem>
<listitem>
@@ -2391,6 +2421,35 @@ necessary to enable them.
</sect2>
<sect2 id="package-imports">
+<title>Import and export extensions</title>
+
+<sect3>
+ <title>Hiding things the imported module doesn't export</title>
+
+<para>
+Technically in Haskell 2010 this is illegal:
+<programlisting>
+module A( f ) where
+ f = True
+
+module B where
+ import A hiding( g ) -- A does not export g
+ g = f
+</programlisting>
+The <literal>import A hiding( g )</literal> in module <literal>B</literal>
+is technically an error (<ulink url="http://www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-1020005.3.1">Haskell Report, 5.3.1</ulink>)
+because <literal>A</literal> does not export <literal>g</literal>.
+However GHC allows it, in the interests of supporting backward compatibility; for example, a newer version of
+<literal>A</literal> might export <literal>g</literal>, and you want <literal>B</literal> to work
+in either case.
+</para>
+<para>
+The warning <literal>-fwarn-dodgy-imports</literal>, which is off by default but included with <literal>-W</literal>,
+warns if you hide something that the imported module does not export.
+</para>
+</sect3>
+
+<sect3>
<title>Package-qualified imports</title>
<para>With the <option>-XPackageImports</option> flag, GHC allows
@@ -2415,9 +2474,9 @@ import "network" Network.Socket
packages when APIs change. It can lead to fragile dependencies in
the common case: modules occasionally move from one package to
another, rendering any package-qualified imports broken.</para>
-</sect2>
+</sect3>
-<sect2 id="safe-imports-ext">
+<sect3 id="safe-imports-ext">
<title>Safe imports</title>
<para>With the <option>-XSafe</option>, <option>-XTrustworthy</option>
@@ -2435,9 +2494,9 @@ import safe qualified Network.Socket as NS
safely imported. For a description of when a import is
considered safe see <xref linkend="safe-haskell"/></para>
-</sect2>
+</sect3>
-<sect2 id="explicit-namespaces">
+<sect3 id="explicit-namespaces">
<title>Explicit namespaces in import/export</title>
<para> In an import or export list, such as
@@ -2465,6 +2524,14 @@ disambiguate this case, thus:
The extension <option>-XExplicitNamespaces</option>
is implied by <option>-XTypeOperators</option> and (for some reason) by <option>-XTypeFamilies</option>.
</para>
+<para>
+In addition, with <option>-XPatternSynonyms</option> you can prefix the name of
+a data constructor in an import or export list with the keyword <literal>pattern</literal>,
+to allow the import or export of a data constructor without its parent type constructor
+(see <xref linkend="patsyn-impexp"/>).
+</para>
+</sect3>
+
</sect2>
<sect2 id="syntax-stolen">
@@ -3882,7 +3949,11 @@ defined in <literal>Data.Foldable</literal>.
<listitem><para> With <option>-XDeriveTraversable</option>, you can derive instances of
the class <literal>Traversable</literal>,
-defined in <literal>Data.Traversable</literal>.
+defined in <literal>Data.Traversable</literal>. Since the <literal>Traversable</literal>
+instance dictates the instances of <literal>Functor</literal> and
+<literal>Foldable</literal>, you'll probably want to derive them too, so
+<option>-XDeriveTraversable</option> implies
+<option>-XDeriveFunctor</option> and <option>-XDeriveFoldable</option>.
</para></listitem>
</itemizedlist>
You can also use a standalone deriving declaration instead
@@ -4317,7 +4388,9 @@ We use default signatures to simplify generic programming in GHC
<sect3 id="nullary-type-classes">
<title>Nullary type classes</title>
-Nullary (no parameter) type classes are enabled with <option>-XNullaryTypeClasses</option>.
+Nullary (no parameter) type classes are enabled with
+<option>-XMultiTypeClasses</option>; historically, they were enabled with the
+(now deprecated) <option>-XNullaryTypeClasses</option>.
Since there are no available parameters, there can be at most one instance
of a nullary class. A nullary type class might be used to document some assumption
in a type signature (such as reliance on the Riemann hypothesis) or add some
@@ -4938,7 +5011,8 @@ with <option>-fcontext-stack=</option><emphasis>N</emphasis>.
In general, as discussed in <xref linkend="instance-resolution"/>,
<emphasis>GHC requires that it be unambiguous which instance
declaration
-should be used to resolve a type-class constraint</emphasis>. This behaviour
+should be used to resolve a type-class constraint</emphasis>.
+This behaviour
can be modified by two flags: <option>-XOverlappingInstances</option>
<indexterm><primary>-XOverlappingInstances
</primary></indexterm>
@@ -4947,6 +5021,8 @@ and <option>-XIncoherentInstances</option>
</primary></indexterm>, as this section discusses. Both these
flags are dynamic flags, and can be set on a per-module basis, using
an <literal>LANGUAGE</literal> pragma if desired (<xref linkend="language-pragma"/>).</para>
+
+
<para>
The <option>-XOverlappingInstances</option> flag instructs GHC to loosen
the instance resolution described in <xref linkend="instance-resolution"/>, by
@@ -4954,18 +5030,83 @@ allowing more than one instance to match, <emphasis>provided there is a most
specific one</emphasis>. The <option>-XIncoherentInstances</option> flag
further loosens the resolution, by allowing more than one instance to match,
irespective of whether there is a most specific one.
+The <option>-XIncoherentInstances</option> flag implies the
+<option>-XOverlappingInstances</option> flag, but not vice versa.
</para>
<para>
-For example, consider
+A more precise specification is as follows.
+The willingness to be overlapped or incoherent is a property of
+the <emphasis>instance declaration</emphasis> itself, controlled by the
+presence or otherwise of the <option>-XOverlappingInstances</option>
+and <option>-XIncoherentInstances</option> flags when that instance declaration is
+being compiled. Now suppose that, in some client module, we are searching for an instance of the
+<emphasis>target constraint</emphasis> <literal>(C ty1 .. tyn)</literal>.
+The search works like this.
+<itemizedlist>
+<listitem><para>
+Find all instances I that <emphasis>match</emphasis> the target constraint;
+that is, the target constraint is a substitution instance of I. These
+instance declarations are the <emphasis>candidates</emphasis>.
+</para></listitem>
+
+<listitem><para>
+Find all <emphasis>non-candidate</emphasis> instances
+that <emphasis>unify</emphasis> with the target constraint.
+Such non-candidates instances might match when the target constraint is further
+instantiated. If all of them were compiled with
+<option>-XIncoherentInstances</option>, proceed; if not, the search fails.
+</para></listitem>
+
+<listitem><para>
+Eliminate any candidate IX for which both of the following hold:
+
+<itemizedlist>
+<listitem><para>There is another candidate IY that is strictly more specific;
+that is, IY is a substitution instance of IX but not vice versa.
+</para></listitem>
+<listitem><para>Either IX or IY was compiled with
+<option>-XOverlappingInstances</option>.
+</para></listitem>
+</itemizedlist>
+
+</para></listitem>
+
+<listitem><para>
+If only one candidate remains, pick it.
+Otherwise if all remaining candidates were compiled with
+<option>-XInccoherentInstances</option>, pick an arbitrary candidate.
+</para></listitem>
+
+</itemizedlist>
+These rules make it possible for a library author to design a library that relies on
+overlapping instances without the library client having to know.
+</para>
+<para>
+Errors are reported <emphasis>lazily</emphasis> (when attempting to solve a constraint), rather than <emphasis>eagerly</emphasis>
+(when the instances themselves are defined). So for example
+<programlisting>
+ instance C Int b where ..
+ instance C a Bool where ..
+</programlisting>
+These potentially overlap, but GHC will not complain about the instance declarations
+themselves, regardless of flag settings. If we later try to solve the constraint
+<literal>(C Int Char)</literal> then only the first instance matches, and all is well.
+Similarly with <literal>(C Bool Bool)</literal>. But if we try to solve <literal>(C Int Bool)</literal>,
+both instances match and an error is reported.
+</para>
+
+<para>
+As a more substantial example of the rules in action, consider
<programlisting>
instance context1 => C Int b where ... -- (A)
instance context2 => C a Bool where ... -- (B)
instance context3 => C a [b] where ... -- (C)
instance context4 => C Int [Int] where ... -- (D)
</programlisting>
-compiled with <option>-XOverlappingInstances</option> enabled. The constraint
-<literal>C Int [Int]</literal> matches instances (A), (C) and (D), but the last
+compiled with <option>-XOverlappingInstances</option> enabled. Now suppose that the type inference
+engine needs to solve The constraint
+<literal>C Int [Int]</literal>. This constraint matches instances (A), (C) and (D), but the last
is more specific, and hence is chosen.
</para>
<para>If (D) did not exist then (A) and (C) would still be matched, but neither is
@@ -4981,7 +5122,7 @@ the head of former is a substitution instance of the latter. For example
substituting <literal>a:=Int</literal>.
</para>
<para>
-However, GHC is conservative about committing to an overlapping instance. For example:
+GHC is conservative about committing to an overlapping instance. For example:
<programlisting>
f :: [b] -> [b]
f x = ...
@@ -5078,56 +5219,6 @@ the program prints
would be to reject module <literal>Help</literal>
on the grounds that a later instance declaration might overlap the local one.)
</para>
-<para>
-The willingness to be overlapped or incoherent is a property of
-the <emphasis>instance declaration</emphasis> itself, controlled by the
-presence or otherwise of the <option>-XOverlappingInstances</option>
-and <option>-XIncoherentInstances</option> flags when that module is
-being defined. Suppose we are searching for an instance of the
-<emphasis>target constraint</emphasis> <literal>(C ty1 .. tyn)</literal>.
-The search works like this.
-<itemizedlist>
-<listitem><para>
-Find all instances I that <emphasis>match</emphasis> the target constraint;
-that is, the target constraint is a substitution instance of I. These
-instance declarations are the <emphasis>candidates</emphasis>.
-</para></listitem>
-
-<listitem><para>
-Find all <emphasis>non-candidate</emphasis> instances
-that <emphasis>unify</emphasis> with the target constraint.
-Such non-candidates instances might match when the target constraint is further
-instantiated. If all of them were compiled with
-<option>-XIncoherentInstances</option>, proceed; if not, the search fails.
-</para></listitem>
-
-<listitem><para>
-Eliminate any candidate IX for which both of the following hold:
-
-<itemizedlist>
-<listitem><para>There is another candidate IY that is strictly more specific;
-that is, IY is a substitution instance of IX but not vice versa.
-</para></listitem>
-<listitem><para>Either IX or IY was compiled with
-<option>-XOverlappingInstances</option>.
-</para></listitem>
-</itemizedlist>
-
-</para></listitem>
-
-<listitem><para>
-If only one candidate remains, pick it.
-Otherwise if all remaining candidates were compiled with
-<option>-XInccoherentInstances</option>, pick an arbitrary candidate.
-</para></listitem>
-
-</itemizedlist>
-These rules make it possible for a library author to design a library that relies on
-overlapping instances without the library client having to know.
-</para>
-<para>The <option>-XIncoherentInstances</option> flag implies the
-<option>-XOverlappingInstances</option> flag, but not vice versa.
-</para>
</sect3>
<sect3 id="instance-sigs">
@@ -5201,21 +5292,30 @@ it explicitly (for example, to give an instance declaration for it), you can imp
from module <literal>GHC.Exts</literal>.
</para>
<para>
-Haskell's defaulting mechanism is extended to cover string literals, when <option>-XOverloadedStrings</option> is specified.
+Haskell's defaulting mechanism (<ulink url="http://www.haskell.org/onlinereport/decls.html#sect4.3.4">Haskell Report, Section 4.3.4</ulink>)
+is extended to cover string literals, when <option>-XOverloadedStrings</option> is specified.
Specifically:
<itemizedlist>
<listitem><para>
-Each type in a default declaration must be an
+Each type in a <literal>default</literal> declaration must be an
instance of <literal>Num</literal> <emphasis>or</emphasis> of <literal>IsString</literal>.
</para></listitem>
<listitem><para>
-The standard defaulting rule (<ulink url="http://www.haskell.org/onlinereport/decls.html#sect4.3.4">Haskell Report, Section 4.3.4</ulink>)
+If no <literal>default</literal> declaration is given, then it is just as if the module
+contained the declaration <literal>default( Integer, Double, String)</literal>.
+</para></listitem>
+
+<listitem><para>
+The standard defaulting rule
is extended thus: defaulting applies when all the unresolved constraints involve standard classes
<emphasis>or</emphasis> <literal>IsString</literal>; and at least one is a numeric class
<emphasis>or</emphasis> <literal>IsString</literal>.
</para></listitem>
</itemizedlist>
+So, for example, the expression <literal>length "foo"</literal> will give rise
+to an ambiguous use of <literal>IsString a0</literal> which, becuase of the above
+rules, will default to <literal>String</literal>.
</para>
<para>
A small example:
@@ -5942,28 +6042,39 @@ instance (GMapKey a, GMapKey b) => GMapKey (Either a b) where
data GMap (Either a b) v = GMapEither (GMap a v) (GMap b v)
...
-instance (Eq (Elem [e])) => Collects ([e]) where
+instance Eq (Elem [e]) => Collects [e] where
type Elem [e] = e
...
</programlisting>
- The most important point about associated family instances is that the
- type indexes corresponding to class parameters must be identical to
- the type given in the instance head; here this is the first argument
- of <literal>GMap</literal>, namely <literal>Either a b</literal>,
- which coincides with the only class parameter.
- </para>
- <para>
- Instances for an associated family can only appear as part of
- instance declarations of the class in which the family was declared -
- just as with the equations of the methods of a class. Also in
- correspondence to how methods are handled, declarations of associated
- types can be omitted in class instances. If an associated family
- instance is omitted, the corresponding instance type is not inhabited;
+Note the following points:
+<itemizedlist>
+<listitem><para>
+ The type indexes corresponding to class parameters must have precisely the same shape
+ the type given in the instance head. To have the same "shape" means that
+ the two types are identical modulo renaming of type variables. For example:
+<programlisting>
+instance Eq (Elem [e]) => Collects [e] where
+ -- Choose one of the following alternatives:
+ type Elem [e] = e -- OK
+ type Elem [x] = x -- OK
+ type Elem x = x -- BAD; shape of 'x' is different to '[e]'
+ type Elem [Maybe x] = x -- BAD: shape of '[Maybe x]' is different to '[e]'
+</programlisting>
+</para></listitem>
+<listitem><para>
+ An instances for an associated family can only appear as part of
+ an instance declarations of the class in which the family was declared,
+ just as with the equations of the methods of a class.
+</para></listitem>
+<listitem><para>
+ The instance for an associated type can be omitted in class instances. In that case,
+ unless there is a default instance (see <xref linkend="assoc-decl-defs"/>),
+ the corresponding instance type is not inhabited;
i.e., only diverging expressions, such
as <literal>undefined</literal>, can assume the type.
- </para>
- <para>
- Although it is unusual, there can be <emphasis>multiple</emphasis>
+</para></listitem>
+<listitem><para>
+ Although it is unusual, there (currently) can be <emphasis>multiple</emphasis>
instances for an associated family in a single instance declaration.
For example, this is legitimate:
<programlisting>
@@ -5977,8 +6088,10 @@ instance GMapKey Flob where
Since you cannot give any <emphasis>subsequent</emphasis> instances for
<literal>(GMap Flob ...)</literal>, this facility is most useful when
the free indexed parameter is of a kind with a finite number of alternatives
- (unlike <literal>*</literal>).
- </para>
+ (unlike <literal>*</literal>). WARNING: this facility may be withdrawn in the future.
+</para></listitem>
+</itemizedlist>
+</para>
</sect3>
<sect3 id="assoc-decl-defs">
@@ -5996,22 +6109,50 @@ class IsBoolMap v where
instance IsBoolMap [(Int, Bool)] where
lookupKey = lookup
</programlisting>
-The <literal>instance</literal> keyword is optional.
- </para>
+In an <literal>instance</literal> declaration for the class, if no explicit
+<literal>type instance</literal> declaration is given for the associated type, the default declaration
+is used instead, just as with default class methods.
+</para>
<para>
-There can also be multiple defaults for a single type, as long as they do not
-overlap:
+Note the following points:
+<itemizedlist>
+<listitem><para>
+ The <literal>instance</literal> keyword is optional.
+</para></listitem>
+<listitem><para>
+ There can be at most one default declaration for an associated type synonym.
+</para></listitem>
+<listitem><para>
+ A default declaration is not permitted for an associated
+ <emphasis>data</emphasis> type.
+</para></listitem>
+<listitem><para>
+ The default declaration must mention only type <emphasis>variables</emphasis> on the left hand side,
+ and the right hand side must mention only type varaibels bound on the left hand side.
+ However, unlike the associated type family declaration itself,
+ the type variables of the default instance are independent of those of the parent class.
+</para></listitem>
+</itemizedlist>
+Here are some examples:
<programlisting>
-class C a where
- type F a b
- type F a Int = Bool
- type F a Bool = Int
+ class C a where
+ type F1 a :: *
+ type instance F1 a = [a] -- OK
+ type instance F1 a = a->a -- BAD; only one default instance is allowed
+
+ type F2 b a -- OK; note the family has more type
+ -- variables than the class
+ type instance F2 c d = c->d -- OK; you don't have to use 'a' in the type instance
+
+ type F3 a
+ type F3 [b] = b -- BAD; only type variables allowed on the LHS
+
+ type F4 a
+ type F4 b = a -- BAD; 'a' is not in scope in the RHS
</programlisting>
+</para>
-A default declaration is not permitted for an associated
-<emphasis>data</emphasis> type.
- </para>
- </sect3>
+</sect3>
<sect3 id="scoping-class-params">
<title>Scoping of class parameters</title>
@@ -8039,7 +8180,7 @@ scope over the methods defined in the <literal>where</literal> part. For exampl
of the Haskell Report)
can be completely switched off by
<option>-XNoMonomorphismRestriction</option>. Since GHC 7.8.1, the monomorphism
-restriction is switched off by default in GHCi.
+restriction is switched off by default in GHCi's interactive options (see <xref linkend="ghci-interactive-options"/>).
</para>
</sect3>
@@ -8112,12 +8253,30 @@ pattern binding must have the same context. For example, this is fine:
<para>
An ML-style language usually generalises the type of any let-bound or where-bound variable,
so that it is as polymorphic as possible.
-With the flag <option>-XMonoLocalBinds</option> GHC implements a slightly more conservative policy:
-<emphasis>it generalises only "closed" bindings</emphasis>.
-A binding is considered "closed" if either
+With the flag <option>-XMonoLocalBinds</option> GHC implements a slightly more conservative policy,
+using the following rules:
<itemizedlist>
-<listitem><para>It is one of the top-level bindings of a module, or </para></listitem>
-<listitem><para>Its free variables are all themselves closed</para></listitem>
+ <listitem><para>
+ A variable is <emphasis>closed</emphasis> if and only if
+ <itemizedlist>
+ <listitem><para> the variable is let-bound</para></listitem>
+ <listitem><para> one of the following holds:
+ <itemizedlist>
+ <listitem><para>the variable has an explicit type signature that has no free type variables, or</para></listitem>
+ <listitem><para>its binding group is fully generalised (see next bullet) </para></listitem>
+ </itemizedlist>
+ </para></listitem>
+ </itemizedlist>
+ </para></listitem>
+
+ <listitem><para>
+ A binding group is <emphasis>fully generalised</emphasis> if and only if
+ <itemizedlist>
+ <listitem><para>each of its free variables is either imported or closed, and</para></listitem>
+ <listitem><para>the binding is not affected by the monomorphism restriction
+ (<ulink url="http://www.haskell.org/onlinereport/decls.html#sect4.5.5">Haskell Report, Section 4.5.5</ulink>)</para></listitem>
+ </itemizedlist>
+ </para></listitem>
</itemizedlist>
For example, consider
<programlisting>
@@ -8126,15 +8285,18 @@ g x = let h y = f y * 2
k z = z+x
in h x + k x
</programlisting>
-Here <literal>f</literal> and <literal>g</literal> are closed because they are bound at top level.
-Also <literal>h</literal> is closed because its only free variable <literal>f</literal> is closed.
-But <literal>k</literal> is not closed because it mentions <literal>x</literal> which is locally bound.
-Another way to think of it is this: all closed bindings <literal>could</literal> be defined at top level.
-(In the example, we could move <literal>h</literal> to top level.)
-</para><para>
-All of this applies only to bindings that lack an explicit type signature, so that GHC has to
-infer its type. If you supply a type signature, then that fixes type of the binding, end of story.
-</para><para>
+Here <literal>f</literal> is generalised because it has no free variables; and its binding group
+is unaffected by the monomorphism restriction; and hence <literal>f</literal> is closed.
+The same reasoning applies to <literal>g</literal>, except that it has one closed free variable, namely <literal>f</literal>.
+Similarly <literal>h</literal> is closed, <emphasis>even though it is not bound at top level</emphasis>,
+because its only free variable <literal>f</literal> is closed.
+But <literal>k</literal> is not closed, because it mentions <literal>x</literal> which is not closed (because it is not let-bound).
+</para>
+<para>
+Notice that a top-level binding that is affected by the monomorphism restriction is not closed, and hence may
+in turn prevent generalisation of bindings that mention it.
+</para>
+<para>
The rationale for this more conservative strategy is given in
<ulink url="http://research.microsoft.com/~simonpj/papers/constraints/index.htm">the papers</ulink> "Let should not be generalised" and "Modular type inference with local assumptions", and
a related <ulink url="http://ghc.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7">blog post</ulink>.
@@ -10885,8 +11047,8 @@ not be substituted, and the rule would not fire.
</sect2>
-<sect2 id="conlike">
-<title>How rules interact with INLINE/NOINLINE and CONLIKE pragmas</title>
+<sect2 id="rules-inline">
+<title>How rules interact with INLINE/NOINLINE pragmas</title>
<para>
Ordinary inlining happens at the same time as rule rewriting, which may lead to unexpected
@@ -10912,7 +11074,14 @@ would have been a better chance that <literal>f</literal>'s RULE might fire.
The way to get predictable behaviour is to use a NOINLINE
pragma, or an INLINE[<replaceable>phase</replaceable>] pragma, on <literal>f</literal>, to ensure
that it is not inlined until its RULEs have had a chance to fire.
+The warning flag <option>-fwarn-inline-rule-shadowing</option> (see <xref linkend="options-sanity"/>)
+warns about this situation.
</para>
+</sect2>
+
+<sect2 id="conlike">
+<title>How rules interact with CONLIKE pragmas</title>
+
<para>
GHC is very cautious about duplicating work. For example, consider
<programlisting>
@@ -11257,69 +11426,6 @@ program even if fusion doesn't happen. More rules in <filename>GHC/List.lhs</fi
</sect2>
-<sect2 id="core-pragma">
- <title>CORE pragma</title>
-
- <indexterm><primary>CORE pragma</primary></indexterm>
- <indexterm><primary>pragma, CORE</primary></indexterm>
- <indexterm><primary>core, annotation</primary></indexterm>
-
-<para>
- The external core format supports <quote>Note</quote> annotations;
- the <literal>CORE</literal> pragma gives a way to specify what these
- should be in your Haskell source code. Syntactically, core
- annotations are attached to expressions and take a Haskell string
- literal as an argument. The following function definition shows an
- example:
-
-<programlisting>
-f x = ({-# CORE "foo" #-} show) ({-# CORE "bar" #-} x)
-</programlisting>
-
- Semantically, this is equivalent to:
-
-<programlisting>
-g x = show x
-</programlisting>
-</para>
-
-<para>
- However, when external core is generated (via
- <option>-fext-core</option>), there will be Notes attached to the
- expressions <function>show</function> and <varname>x</varname>.
- The core function declaration for <function>f</function> is:
-</para>
-
-<programlisting>
- f :: %forall a . GHCziShow.ZCTShow a ->
- a -> GHCziBase.ZMZN GHCziBase.Char =
- \ @ a (zddShow::GHCziShow.ZCTShow a) (eta::a) ->
- (%note "foo"
- %case zddShow %of (tpl::GHCziShow.ZCTShow a)
- {GHCziShow.ZCDShow
- (tpl1::GHCziBase.Int ->
- a ->
- GHCziBase.ZMZN GHCziBase.Char -> GHCziBase.ZMZN GHCziBase.Cha
-r)
- (tpl2::a -> GHCziBase.ZMZN GHCziBase.Char)
- (tpl3::GHCziBase.ZMZN a ->
- GHCziBase.ZMZN GHCziBase.Char -> GHCziBase.ZMZN GHCziBase.Cha
-r) ->
- tpl2})
- (%note "bar"
- eta);
-</programlisting>
-
-<para>
- Here, we can see that the function <function>show</function> (which
- has been expanded out to a case expression over the Show dictionary)
- has a <literal>%note</literal> attached to it, as does the
- expression <varname>eta</varname> (which used to be called
- <varname>x</varname>).
-</para>
-
-</sect2>
-
</sect1>
<sect1 id="special-ids">
@@ -11613,7 +11719,7 @@ described in <ulink
url="http://www.seas.upenn.edu/~sweirich/papers/popl163af-weirich.pdf">Generative
type abstraction and type-level computation</ulink>, published at POPL 2011.</para>
-<sect2>
+<sect2 id="nominal-representational-and-phantom">
<title>Nominal, Representational, and Phantom</title>
<para>The goal of the roles system is to track when two types have the same
@@ -11670,7 +11776,7 @@ are unrelated.</para>
</sect2>
-<sect2>
+<sect2 id="role-inference">
<title>Role inference</title>
<para>
@@ -11724,7 +11830,7 @@ but role nominal for <literal>b</literal>.</para>
</sect2>
-<sect2>
+<sect2 id="role-annotations">
<title>Role annotations
<indexterm><primary>-XRoleAnnotations</primary></indexterm>
</title>
diff --git a/docs/users_guide/gone_wrong.xml b/docs/users_guide/gone_wrong.xml
index 114b06cfd6..bb5fcb0d4e 100644
--- a/docs/users_guide/gone_wrong.xml
+++ b/docs/users_guide/gone_wrong.xml
@@ -146,7 +146,7 @@
<emphasis>must</emphasis> be re-compiled.</para>
<para>A useful option to alert you when interfaces change is
- <option>-hi-diffs</option><indexterm><primary>-hi-diffs
+ <option>-ddump-hi-diffs</option><indexterm><primary>-ddump-hi-diffs
option</primary></indexterm>. It will run
<command>diff</command> on the changed interface file,
before and after, when applicable.</para>
@@ -167,7 +167,7 @@
<screen>
% rm *.o # scrub your object files
-% make my_prog # re-make your program; use -hi-diffs to highlight changes;
+% make my_prog # re-make your program; use -ddump-hi-diffs to highlight changes;
# as mentioned above, use -dcore-lint to be more paranoid
% ./my_prog ... # retry...
</screen>
diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml
index db32f38870..8a5589acda 100644
--- a/docs/users_guide/phases.xml
+++ b/docs/users_guide/phases.xml
@@ -576,8 +576,22 @@ $ cat foo.hspp</screen>
</term>
<listitem>
<para>Omit code generation (and all later phases)
- altogether. Might be of some use if you just want to see
- dumps of the intermediate compilation phases.</para>
+ altogether. This is useful if you're only interested in
+ type checking code.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>-fwrite-interface</option>
+ <indexterm><primary><option>-fwrite-interface</option></primary></indexterm>
+ </term>
+ <listitem>
+ <para>Always write interface files. GHC will normally write
+ interface files automatically, but this flag is useful with
+ <option>-fno-code</option>, which normally suppresses generation
+ of interface files. This is useful if you want to type check
+ over multiple runs of GHC without compiling dependencies.</para>
</listitem>
</varlistentry>
diff --git a/docs/users_guide/ug-book.xml.in b/docs/users_guide/ug-book.xml.in
index dc5d4f7c35..b87563ac3b 100644
--- a/docs/users_guide/ug-book.xml.in
+++ b/docs/users_guide/ug-book.xml.in
@@ -17,7 +17,6 @@
&lang-features;
&ffi-chap;
&extending-ghc;
-&external-core;
&wrong;
&utils;
&win32-dll;
diff --git a/docs/users_guide/ug-ent.xml.in b/docs/users_guide/ug-ent.xml.in
index ce87089f24..6753ff7e5b 100644
--- a/docs/users_guide/ug-ent.xml.in
+++ b/docs/users_guide/ug-ent.xml.in
@@ -3,7 +3,7 @@
<!ENTITY flags SYSTEM "flags.xml">
<!ENTITY license SYSTEM "license.xml">
<!ENTITY intro SYSTEM "intro.xml" >
-<!ENTITY relnotes1 SYSTEM "7.8.1-notes.xml" >
+<!ENTITY relnotes1 SYSTEM "7.10.1-notes.xml" >
<!ENTITY using SYSTEM "using.xml" >
<!ENTITY code-gens SYSTEM "codegens.xml" >
<!ENTITY runtime SYSTEM "runtime_control.xml" >
@@ -12,7 +12,6 @@
<!ENTITY sooner SYSTEM "sooner.xml" >
<!ENTITY lang-features SYSTEM "lang.xml" >
<!ENTITY glasgowexts SYSTEM "glasgow_exts.xml" >
-<!ENTITY external-core SYSTEM "external_core.xml" >
<!ENTITY packages SYSTEM "packages.xml" >
<!ENTITY parallel SYSTEM "parallel.xml" >
<!ENTITY safehaskell SYSTEM "safe_haskell.xml" >
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index 8d8211eb5a..921d5a3345 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -899,20 +899,37 @@ ghci> :set -fprint-explicit-foralls
ghci> :t f
f :: forall a. a -> a
</screen>
- Using <option>-fprint-explicit-kinds</option> makes GHC print kind-foralls and kind applications
+However, regardless of the flag setting, the quantifiers are printed under these circumstances:
+<itemizedlist>
+<listitem><para>For nested <literal>foralls</literal>, e.g.
+<screen>
+ghci> :t GHC.ST.runST
+GHC.ST.runST :: (forall s. GHC.ST.ST s a) -> a
+</screen>
+</para></listitem>
+<listitem><para>If any of the quantified type variables has a kind
+that mentions a kind variable, e.g.
+<screen>
+ghci> :i Data.Coerce.coerce
+coerce ::
+ forall (k :: BOX) (a :: k) (b :: k). Coercible a b => a -> b
+ -- Defined in GHC.Prim
+</screen>
+</para></listitem>
+</itemizedlist>
+ </para>
+ <para>
+ Using <option>-fprint-explicit-kinds</option> makes GHC print kind arguments
in types, which are normally suppressed. This can be important when you are using kind polymorphism.
For example:
<screen>
ghci> :set -XPolyKinds
ghci> data T a = MkT
ghci> :t MkT
-MkT :: T b
+MkT :: forall (k :: BOX) (a :: k). T a
ghci> :set -fprint-explicit-foralls
ghci> :t MkT
-MkT :: forall (b::k). T b
-ghci> :set -fprint-explicit-kinds
-ghci> :t MkT
-MkT :: forall (k::BOX) (b:k). T b
+MkT :: forall (k :: BOX) (a :: k). T k a
</screen>
</para>
</listitem>
@@ -1719,15 +1736,50 @@ f "2" = 2
<indexterm><primary>unused binds, warning</primary></indexterm>
<indexterm><primary>binds, unused</primary></indexterm>
<para>Report any function definitions (and local bindings)
- which are unused. For top-level functions, the warning is
- only given if the binding is not exported.</para>
- <para>A definition is regarded as "used" if (a) it is exported, or (b) it is
- mentioned in the right hand side of another definition that is used, or (c) the
- function it defines begins with an underscore. The last case provides a
- way to suppress unused-binding warnings selectively. </para>
- <para> Notice that a variable
- is reported as unused even if it appears in the right-hand side of another
- unused binding. </para>
+ which are unused. More precisely:
+
+ <itemizedlist>
+ <listitem><para>Warn if a binding brings into scope a variable that is not used,
+ except if the variable's name starts with an underscore. The "starts-with-underscore"
+ condition provides a way to selectively disable the warning.
+ </para>
+ <para>
+ A variable is regarded as "used" if
+ <itemizedlist>
+ <listitem><para>It is exported, or</para></listitem>
+ <listitem><para>It appears in the right hand side of a binding that binds at
+ least one used variable that is used</para></listitem>
+ </itemizedlist>
+ For example
+ <programlisting>
+module A (f) where
+f = let (p,q) = rhs1 in t p -- Warning about unused q
+t = rhs3 -- No warning: f is used, and hence so is t
+g = h x -- Warning: g unused
+h = rhs2 -- Warning: h is only used in the right-hand side of another unused binding
+_w = True -- No warning: _w starts with an underscore
+ </programlisting>
+ </para></listitem>
+
+ <listitem><para>
+ Warn if a pattern binding binds no variables at all, unless it is a lone, possibly-banged, wild-card pattern.
+ For example:
+ <programlisting>
+Just _ = rhs3 -- Warning: unused pattern binding
+(_, _) = rhs4 -- Warning: unused pattern binding
+_ = rhs3 -- No warning: lone wild-card pattern
+!_ = rhs4 -- No warning: banged wild-card pattern; behaves like seq
+ </programlisting>
+ The motivation for allowing lone wild-card patterns is they
+ are not very different from <literal>_v = rhs3</literal>,
+ which elicits no warning; and they can be useful to add a type
+ constraint, e.g. <literal>_ = x::Int</literal>. A lone
+ banged wild-card pattern is is useful as an alternative
+ (to <literal>seq</literal>) way to force evaluation.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
</listitem>
</varlistentry>
@@ -1814,6 +1866,16 @@ f "2" = 2
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-fwarn-inline-rule-shadowing</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-inline-rule-shadowing</option></primary></indexterm>
+ <para>Warn if a rewrite RULE might fail to fire because the function might be
+ inlined before the rule has a chance to fire. See <xref linkend="rules-inline"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
<para>If you're feeling really paranoid, the
@@ -2967,44 +3029,6 @@ data D = D !C
</sect1>
&runtime;
-
-<sect1 id="ext-core">
- <title>Generating and compiling External Core Files</title>
-
- <indexterm><primary>intermediate code generation</primary></indexterm>
-
- <para>GHC can dump its optimized intermediate code (said to be in &ldquo;Core&rdquo; format)
- to a file as a side-effect of compilation. Non-GHC back-end tools can read and process Core files; these files have the suffix
- <filename>.hcr</filename>. The Core format is described in <ulink url="../../core.pdf">
- <citetitle>An External Representation for the GHC Core Language</citetitle></ulink>,
- and sample tools
- for manipulating Core files (in Haskell) are available in the
- <ulink url="http://hackage.haskell.org/package/extcore">extcore package on Hackage</ulink>. Note that the format of <literal>.hcr</literal>
- files is <emphasis>different</emphasis> from the Core output format that GHC generates
- for debugging purposes (<xref linkend="options-debugging"/>), though the two formats appear somewhat similar.</para>
-
- <para>The Core format natively supports notes which you can add to
- your source code using the <literal>CORE</literal> pragma (see <xref
- linkend="pragmas"/>).</para>
-
- <variablelist>
-
- <varlistentry>
- <term>
- <option>-fext-core</option>
- <indexterm><primary><option>-fext-core</option></primary></indexterm>
- </term>
- <listitem>
- <para>Generate <literal>.hcr</literal> files.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
-<para>Currently (as of version 6.8.2), GHC does not have the ability to read in External Core files as source. If you would like GHC to have this ability, please <ulink url="http://ghc.haskell.org/trac/ghc/wiki/MailingListsAndIRC">make your wishes known to the GHC Team</ulink>.</para>
-
-</sect1>
-
&debug;
&flags;