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 6.10 branch.
Considerably improved support for parallel execution. GHC 6.10 would execute parallel Haskell programs, but performance was often not very good. Simon Marlow has done lots of performance tuning in 6.12, removing many of the accidental (and largely invisible) gotchas that made parallel programs run slowly.
As part of this parallel-performance tuning, Satnam Singh and Simon Marlow have developed ThreadScope, a GUI that lets you see what is going on inside your parallel program. It's a huge step forward from "It takes 4 seconds with 1 processor, and 3 seconds with 8 processors; now what?". ThreadScope will be released separately from GHC, but at more or less the same time as GHC 6.12.
Dynamic linking is now supported on Linux, and support for other platforms will follow. Thanks for this most recently go to the Industrial Haskell Group who pushed it into a fully-working state; dynamic linking is the culmination of the work of several people over recent years. One effect of dynamic linking is that binaries shrink dramatically, because the run-time system and libraries are shared. Perhaps more importantly, it is possible to make dynamic plugins from Haskell code that can be used from other applications.
The I/O libraries are now Unicode-aware, so your Haskell programs should now handle text files containing non-ascii characters, without special effort.
The package system has been made more robust, by associating each installed package with a unique identifier based on its exposed ABI. Now, cases where the user re-installs a package without recompiling packages that depend on it will be detected, and the packages with broken dependencies will be disabled. Previously, this would lead to obscure compilation errors, or worse, segfaulting programs.
This change involved a lot of internal restructuring, but it paves the way for future improvements to the way packages are handled. For instance, in the future we expect to track profiled packages independently of non-profiled ones, and we hope to make it possible to upgrade a package in an ABI-compatible way, without recompiling the packages that depend on it. This latter facility will be especially important as we move towards using more shared libraries.
The new TupleSections
language extension
enables tuple sections, such as (, True)
.
See Section 7.3.13, “Tuple sections” for more information.
The new MonoLocalBinds
language extension
disables type variable generalisation for bindings in
let
and where
clauses.
It is now possible to derive instances for GADT datatypes, provided the standard instance code is valid for the datatype.
The new DeriveFunctor
,
DeriveFoldable
and
DeriveTraversable
language extensions
enable deriving for the respective type classes.
See Section 7.5.3, “Deriving clause for extra classes (Typeable
, Data
, etc)” for more information.
The new NoNPlusKPatterns
language extension
disables n+k
patterns.
See Section 7.3.7, “n+k patterns” for more information.
The new ExplicitForAll
language extension
enables explicit forall's in types.
See Section 7.8.1, “Explicit universal quantification (forall)” for more information.
The new DoRec
language extension
provides new syntax for recursive do-notation, and the old
RecursiveDo
language extension has been
deprecated.
See Section 7.3.8, “The recursive do-notation
” for more information.
Some improvements have been made to record puns:
C { A.a }
now works, expanding to
C { A.a = a }
.
-fwarn-unused-matches
no longer
warns about bindings introduced by
f (C {..}) = x
.
The RecordWildCards
language
extension implies
DisambiguateRecordFields
.
Declarations such as
data T a where MkT :: forall a. Eq a => { x,y :: !a } -> T a
are now only accepted if the extension
TypeOperators
is on.
It is now possible to define GADT records with class constraints. The syntax is:
data T a where MkT :: forall a. Eq a => { x,y :: !a } -> T a
You can now list multiple GADT constructors with the same type, e.g.:
data T where A, B :: T C :: Int -> T
It is now possible to use GADT syntax for data families:
data instance T [a] where T1 :: a -> T [a]
and make data instances be GADTs:
data instance T [a] where T1 :: Int -> T [Int] T2 :: a -> b -> T [(a,b)]
Record updates can now be used with datatypes containing existential type variables, provided the fields being altered do not mention the existential types.
The ImpredicativeTypes
extension now imples
the RankNTypes
extension.
The ImpredicativeTypes
extension is no
longer enabled by -fglasgow-exts
, and
has been deprecated.
You can now give multi-line DEPRECATED
and
WARNING
pragmas:
{-# DEPRECATED defaultUserHooks ["Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2" , "compatibility in which case you must stick with defaultUserHooks"] #-}
The -#include
flag and
INCLUDE
pragma are now deprecated and
ignored. Since version 6.10.1, GHC has generated its own C
prototypes for foreign calls, rather than relying on
prototypes from C header files.
The threadsafe
foreign import safety level
is now deprecated; use safe
instead.
There is a new FFI calling convention called
prim
, which allows calling C-- functions
(see Section 8.1.3, “Primitive imports”).
Most users are not expected to need this.
A warning is now emitted if an unlifted type is bound in a
lazy pattern (in let
or
where
clause, or in an irrefutable pattern)
unless it is inside a bang pattern.
This warning is controlled by the
-fwarn-lazy-unlifted-bindings
flag.
In a future version of GHC this will be an error.
There are two new warnings if a monadic result of type other than
m ()
is used in a do
block, but its result is not bound.
The flags -fwarn-unused-do-bind
and -fwarn-wrong-do-bind
control
these warnings (see Section 4.7, “Warnings and sanity-checking”).
The new flag -fwarn-dodgy-exports
controls
whether an error is given for exporting a type synonym as
T(..)
.
Name shadowing warnings are no longer given for variable names beginning with an underscore.
When -Werror
is given, we now pass
-Werror
to cpp
.
The following options are all described in Section 4.15.3, “RTS options to control the garbage collector”.
The flag +RTS -N
now automatically
determines how many threads to use, based on the number
of CPUs in your machine.
The parallel GC now uses the same threads as the mutator,
with the consequence that you can no longer select a
different number of threads to use for GC.
The -g
RTS
option has been removed, except that n
-g1
is
still accepted for backwards compatibility.
The new flag
+RTS -qg
sets
the minimum generation for which parallel garbage collection
is used. Defaults to 1. The flag gen
-qg
on
its own disables parallel GC.
The new flag +RTS -qb
controls load balancing in the parallel GC.
gen
The new flag +RTS -qa
uses the OS to set thread affinity (experimental).
If you link with the -eventlog
flag, then
the new flag +RTS -l
generates
files, which tools such as ThreadScope can use to show the
behaviour of your program (see Section 4.15.6, “Tracing”). The
prog
.eventlog+RTS -D>
output
is also sent to the eventlog file if this option is enabled.
The x
+RTS -v
flag sends eventlog data to
stderr instead.
There is a new statistic in the +RTS -s
output:
SPARKS: 1430 (2 converted, 1427 pruned)
This tells you how many sparks (requests for parallel
execution, caused by calls to par
) were
created, how many were actually evaluated in parallel
(converted), and how many were found to be already evaluated
and were thus discarded (pruned). Any unaccounted for sparks
are simply discarded at the end of evaluation.
We now require GHC >= 6.8 to build.
We now require that gcc is >= 3.0.
In order to generate the parsers, happy >= 1.16 is now required. The parsers are pre-generated in the source tarball, so most users will not need Happy.
It is now possible to build GHC with a simple, BSD-licensed
Haskell implementation of Integer, instead of the
implementation on top of GMP. To do so, set
INTEGER_LIBRARY
to
integer-simple
in
mk/build.mk
.
The build system has been rewritten for the 6.12 series. See the building guide for more information.
The build system now uses variables like
bindir
compatibly with the GNU standard.
The "Interface file version" field of the
ghc --info
output has been removed, as it
is no longer used by GHC.
There is a new "LibDir" field in the
ghc --info
output.
A field f
in the
ghc --info
can now be printed with
ghc --print-
, with letters lower-cased
and spaces replaced by dashes.
f
GHC now works (as a 32bit application) on OS X Snow Leopard.
The native code generator now works on Sparc Solaris.
Haddock interface files are now portable between different architectures.
The new linker flag -eventlog
enables the
+RTS -l
event logging features. The
-debug
flag also enables them.
There is a new flag -feager-blackholing
which typically gives better performing code when running
with multiple threads.
See Section 4.13.1, “Compile-time options for SMP parallelism” for more
information.
There is a new flag -fbuilding-cabal-package
which signals to GHC that it is being run by a build system,
rather than invoked directly. This currently means that GHC
gives different error messages in certain situations.
The following flags were static, but are now dynamic:
-fext-core
,
-fauto-sccs-on-all-toplevs
,
-auto-all
,
-no-auto-all
,
-fauto-sccs-on-exported-toplevs
,
-auto
,
-no-auto
,
-fauto-sccs-on-individual-cafs
,
-caf-all
and
-no-caf-all
.
If the argument to :set prompt
starts with
a double quote then it is read with Haskell String syntax,
e.g.:
Prelude> :set prompt "Loaded: %s\n> " Loaded: Prelude >
The arguments to :set set
and :set show
can now be tab completed.
We inherit some benefits from an upgraded version of haskeline:
A multitude of new emacs and vi commands.
New preference 'historyDuplicates' to prevent storage of duplicate lines.
Support PageUp and PageDown keys.
You can now omit the splice notation for top-level declaration splices, e.g.:
data T = T1 | T2 deriveMyStuff ''T
Splices are now nestable, e.g. you can say
f x = $(g $(h 'x))
.
It is now possible to splice in types.
Shared libraries are now supported on x86 and x86_64 Linux.
To use shared libraries, use the -dynamic
flag.
See Section 4.11, “Using shared libraries” for more information.
The new -fno-shared-implib
flag can be used
to stop GHC generating the .lib
import
library when making a dynamic library. This reduces the disk
space used when you do not need it.
Packages can now be identified by a "package ID", which is
based on a hash of the ABIs. The new flag
-package-id
allows packages to be
selected by this identifier (see Section 4.8.5, “Package IDs, dependencies, and broken packages”). Package IDs enable GHC to detect potential
incompatibilities between packages and broken dependencies
much more accurately than before.
The new flag --abi-hash
, used thus:
ghc --abi-hash M1 M2 ...
prints the combined hash of all the modules listed. It is used to make package IDs.
You can now give ghc-pkg
a
-v0
flag to make it be silent,
-v1
for normal verbosity (the default),
or -v2
or -v
for
verbose output.
Rather than being a single package.conf
file,
package databases now consist of a directory containing one
file per package, and a binary cache of the information.
GHC should be much faster to start up when the package
database grows large.
There is a new command ghc-pkg init
to
create a package database.
There is a new command ghc-pkg dot
to
generate a GraphViz graph of the dependencies between
installed packages.
There is a new command ghc-pkg recache
to
update the package database cache should it become out of
date, or for registering packages manually.
GHC no longer comes with any extralibs; instead, the Haskell Platform will provide a consistent set of additional libraries.
Version number 0.3.0.0 (was 0.2.0.0)
The Data.Array.Diff
module has been moved
to its own package.
Version number 4.2.0.0 (was 4.1.0.0)
We also ship a base version 3.0.3.2 (was 3.0.3.1), so legacy code should continue to work. This package is now deprecated, and will be removed in a future version of GHC.
Handle IO now supports automatic character set encoding
and newline translation. For more information, see the
"Unicode encoding/decoding" and "Newline conversion" sections
in the System.IO
haddock docs.
Lazy I/O now throws an exception if an error is
encountered, in a divergence from the Haskell 98 spec which
requires that errors are discarded (see Section 21.2.2 of
the Haskell 98 report). The exception thrown is the usual
IO exception that would be thrown if the failing IO
operation was performed in the IO monad, and can be caught
by System.IO.Error.catch
or Control.Exception.catch
.
It is now possible to create your own handles.
For more information, see the
GHC.IO.Handle
haddock docs.
System.IO
now exports two new functions,
openTempFileWithDefaultPermissions
and
openBinaryTempFileWithDefaultPermissions
.
Data.Fixed
now provides
Data
and Typeable
instances for Fixed
, and exports
a number of new types:
E0
, Uni
,
E1
, Deci
,
E2
, Centi
,
E3
, Milli
,
E9
and Nano
.
In Control.Exception
,
BlockedOnDeadMVar
has been renamed to
BlockedIndefinitelyOnMVar
and BlockedIndefinitely
has been renamed to
BlockedIndefinitelyOnSTM
.
The Control.OldException
module has been
deprecated.
System.Posix.Internals.setNonBlockingFD
now takes an additional Bool
argument, so
you can turn blocking back on again.
A new function eof
has been added to
Text.ParserCombinators.ReadP
.
The Foreign.C.Types.CLDouble
type has
been removed. It was never correct, but just a duplicate of
Foreign.C.Types.CDouble
.
In Data.Data
, the
StringRep
and
StringConstr
constructors have been
removed. The CharRep
and
CharConstr
constructors should be used
instead.
In Data.Data
,
mkIntConstr
has been deprecated in favour
of the new mkIntegralConstr
.
In Data.Data
,
mkFloatConstr
has been deprecated in
favour of the new mkRealConstr
.
In Data.Data
,
mkNorepType
has been deprecated in
favour of the new mkNoRepType
.
Version number 1.8.0.2 (was 1.6.0.3)
Many API changes. See the Cabal docs for more information.
Version number 0.3.0.0 (was 0.2.0.1)
mapAccumRWithKey
has been added to
Data.IntMap
.
A Traversable
instance has been added to
Data.IntMap.IntMap
.
The types of Data.IntMap.intersectionWith
and Data.IntMap.intersectionWithKey
have
been changed from
intersectionWith :: (a -> b -> a) -> IntMap a -> IntMap b -> IntMap a intersectionWithKey :: (Key -> a -> b -> a) -> IntMap a -> IntMap b -> IntMap a
to
intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
The types of Data.IntMap.findMin
and Data.IntMap.findMax
have
been changed from
findMin :: IntMap a -> a findMax :: IntMap a -> a
to
findMin :: IntMap a -> (Int,a) findMax :: IntMap a -> (Int,a)
Data.Map
now exports
mapAccumRWithKey
,
foldrWithKey
,
foldlWithKey
and
toDescList
.
Data.Sequence
now exports
replicate
,
replicateA
,
replicateM
,
iterateN
,
unfoldr
,
unfoldl
,
scanl
,
scanl1
,
scanr
,
scanr1
,
tails
,
inits
,
takeWhileL
,
takeWhileR
,
dropWhileL
,
dropWhileR
,
spanl
,
spanr
,
breakl
,
breakr
,
partition
,
filter
,
sort
,
sortBy
,
unstableSort
,
unstableSortBy
,
elemIndexL
,
elemIndicesL
,
elemIndexR
,
elemIndicesR
,
findIndexL
,
findIndicesL
,
findIndexR
,
findIndicesR
,
foldlWithIndex
,
foldrWithIndex
,
mapWithIndex
,
zip
,
zipWith
,
zip3
,
zipWith3
,
zip4
and
zipWith4
.
Version number 1.0.1.0 (was 1.0.0.3)
A new function copyPermissions
has been
added to System.Directory
.
All the dph packages are version 0.4.0.
Version number 1.1.0.3 (was 1.1.0.2)
The list of characters that are invalid in filenames on
Windows now includes \
(backslash).
Version number 1.0.0.2 (was 1.0.0.1)
Date and time in ISO8601 format are now separated by
T
rather than a space.
Version number 2.4.0.0 (was 2.3.0.1)
Support for inline
and
specialise
pragmas has been added.
Support for bang patterns has been added
Support for kind annotations has been added
Support for equality constraints has been added
Support for type family declarations has been added
Version number 2.4.0.0 (was 2.3.2.0)
System.Posix.IO
now exports
fdReadBuf
and
fdWriteBuf
.
System.Posix.Process.executeFile
now
returns IO a
instead of
IO ()
.
Version number 2.2.0.1 (was 2.2.0.0)
System.Win32.File
now exports
WIN32_FIND_DATA
,
FindData
,
getFindDataFileName
,
findFirstFile
,
findNextFile
and
findClose
.
System.Win32.Info
now exports
getCurrentDirectory
,
getTemporaryDirectory
,
getFullPathName
and
searchPath
.
System.Win32.Types
now exports
HRESULT
.
There is a new module System.Win32.Shell
.