GADTs (Generalised Abstract Datatypes) are now supported. See Section 7.5, “Generalised Algebraic Data Types”.
Support for Software Transactional Memory, a new method for communication between concurrent threads. Documentation is a bit light so far, but see Control.Concurrent.STM. Also, there is a paper on STM.
There is a new machanism for mutually recursive modules: see
Section 4.6.9, “How to compile mutually recursive modules”. Modules
which are to be imported before they are compiled must have a
.hs-boot file rather than a
.hi-boot file. The
file is compiled into a
.hi-boot file by the compiler, this removes the
previous restriction that only original names can be used in the
The declarations in the
.hs-boot file are also
checked for consistency when the real module is compiled.
.hs-boot files are now tracked properly.
The dependency generator, ghc -M,
now follows imports recursively, just like ghc --make.
So you can usually say simply
ghc -M Main rather than listing the source files
explicitly (ghc -M *.hs).
GHC now includes the Cabal framework, which entails lots of changes to the package system: see Section 4.8, “ Packages ” for details. Packages now have versions, and it is possible to have multiple versions of a package installed (but only one version can be used in a given program). Packages can now contain “hidden” modules, that is modules which are not allowed to be imported by the client.
There are some new GHC
-ignore-package, and the
-package-name option is now deprecated. The
ghc-pkg command has a new command-line
syntax, and the format of the package files it accepts is also
GHC now keeps much more accurate source locations in its internal abstract syntax. By default, this results in error messages which contain column numbers in addition to line numbers. e.g.
read001.hs:25:10: Variable not in scope: `+#'
Additionally, you can ask GHC to report the full span (start and
end-location) for error messages by giving the
option (See Section 4.5, “Help and verbosity options”). e.g.
read001.hs:25:10-11: Variable not in scope: `+#'
Template Haskell changes:
The main TH syntax data type now uses
Name instead of
for names (both binding sites and occurrences).
There is new quoting syntax to refer to the
Name of an in-scope identifier:
'x for variables and data constructors, and
''T for type constructors and
reify function now takes a
Name and returns an
structure, which describes the thing that has been
OPTIONS pragma has been renamed to
OPTIONS is still
accepted, but deprecated). See Section 7.9.5, “OPTIONS_GHC pragma”.
Deprecation annotations now travel with an entity if it is re-exported.
When not optimising, GHC will now not emit the definitions of data constructors into the interface file. This will result in less recompilation when datatypes change and optimisation is off.
Changes to scoped type variables: type signatures may
now bind type variables which scope over the definition of the
function. This happens if the type variables are bound by an
forall in the type signature (see Section 7.4.10, “Scoped type variables
overlapping-instance errors are checked and reported lazily, rather than eagerly
(see Section 220.127.116.11, “Overlapping instances”).
Previously a program was rejected if two instance declarations could
lead to a situation in which a constraint matches both instances without one being
more specific than the other. Now the program is rejected only if a constraint is
actually encountered which leads to this ambiguous situation.
This is basically good, but it means you need the
flag in the module that calls the overloaded function, rather than the one
that defines it.
Outstanding finalizers are no longer run at the end of program execution. Before, GHC was attempting to guarantee that finalizers were always run, but in fact it failed to provide this guarnatee in some cases. Providing this guarantee in general is hard, maybe impossible.
Finalizers are used to close and flush Handles. To prevent undue
stderr are now always flushed at the end of
program execution. Other Handles are not flushed on exit, however: we
recommend that all Handles be explicitly closed when they are no
runghc program is included, which loads
a Haskell script given as an argument. It is equivalent to
ghc -e Main.main, but can be used to run Haskell
scripts on systems that understand the
for script files (eg.
Depending on your installation of GHC, and what other Haskell
compilers you have installed,
runhaskell may be a
Windows: in a GUI-only program (compiled with
-optl-mwindows) trace messages from Debug.Trace are
sent to the debug console. A standard Windows debugger can be used
to view the messages. Also, error messages from the RTS are sent to
popped up in a message box, and debugging messages from the RTS are
sent to the debug console.
In a GUI-only Windows program, the
stderr Handles should not be
used. They will usually not be connected to valid file descriptors,
and attempting to output via these handles will probably result in an
-fwarn-orphans. See Section 4.7, “Warnings and sanity-checking”.
GHC now defines
the current operating system and architecture respectively, when
-cpp. This avoids the need to
ghcconfig.h in many cases.
-fgenerics is now required to get derivable type-class
support (previously this was the default). The libraries are all
built with this flag on.
-optdep-include-prelude is now called
-optdep-include-pkg-deps. Section 4.6.11, “Dependency generation”.
-c flag can now be used at the same time as
--make, which makes the
flag superfluous. Hence,
-no-link is now
commands no longer emit types with explicit
foralls, unless the
-fglasgow-exts option is on.
:info command now shows instances of
classes and datatypes, but only those that refer to classes or types
that are in scope.
Windows: Ctrl-C works to some extent in GHCi. Best results when using GHCi in a standard Windows Command Shell, rather than a cygwin shell window.
New packages included in 6.4:
Win32-1.0 (if available),
stm-1.0. See the
for the contents of these packages.
The new package
mtl-1.0 contains the monad
transformer library (the modules under
Control.Monad, but not
Control.Monad itself). These modules were
previously in the
The new package
Language.Haskell.THSyntax and other Template Haskell support.
Documentation has been improved for many standard libraries.
Debug.QuickCheck is now
Control.Arrow: new functions
Various missing instances of
graphFromEdges returns more information, the old version is still available as
Data.HashTable: new function
Data.List: new function
Data.Tree: new family of functions
unfoldTree et. al.
Debug.Trace: new function
Foreign.C.String: new types
CWString and associated functions.
Foreign.Marshal.Array: new functions
Many of the
GHC.* modules are now omitted from
the docuemntation. These are internal modules, and in most cases
should not be imported by user code.
System.Console.GetOpt: new function
System.Directory: lots of additions.
System.Environment: new function
System.Info: new functions
Text.ParserCombinators.ReadP: lots of additions.
Text.Regex: new functions
Network.Socket: new functions
Show SockAddr added.
Network.URI has been completely rewritten, and now conforms to RFC2732.
hClose stdin now actually closes
stdin, and similarly for
Initial support for position-independent code and dynamic linking is in. Allegedly works on PowerPC/MacOS X, not quite ready on x86/Linux and other platforms yet.
The back-end and code generators have been completely rewritten. GHC now uses an intermediate language that is closely based on C––, and from there it compiles to either C or native code, and in the future it will generate real C––. The only working native code generators right now are x86 and PowerPC; the Sparc native code generator has bitrotted in the rewrite.
As part of this rewrite, we converted the parts of the RTS
that were written in hand-coded
.hc files into C––
code which is parsed and compiled by GHC itself. In theory this
means you can bootstrap GHC without using the mangler at all, by
compiling these files straight to native code. In practice, however,
the native code generator in GHC isn't quite good enough yet to do
this, and the RTS files have to be compiled via C.
Big changes to the way that declarations from interface files are read in, which should result in fewer interface files being read and therefore quicker compilation.
make -j8 now works for a full build of
GHC's documentation has now been converted from DocBook SGML to DocBook XML.
config.h header file is now called
The source tree has been cleaned up with respect to the use of
related symbols. The second stage build will now get the correct
symbols defined. A comment at the top of
mk/config.mk.in, where these symbols are defined,
describes the ussage of these symbols in the source tree.
Blocking I/O in the threaded RTS is now done by a single I/O
manager thread, which performs the blocking
select() operation to wait for all outstanding I/O
requests. Previously this was done in the RTS scheduler, but it is
better to do this in Haskell because it is simpler, and results in
fewer calls to
select. (This change affects Unix
Happy 1.15 is required to build GHC, as we now use the real
parser to extract the module name and imports from a source file when
doing initial dependency analysis of the program for
GHCi. This requires a new feature in Happy
%partial) for parsing partial files.