# Release notes for version 6.6

## User-visible compiler changes

- GHC now supports SMP: when you compile with `-threaded`, you now get an RTS flag `-N` that allows you to specify the number of OS threads that GHC should use. Defaults to 1. See and .

- GHC now handles impredicative polymorphism; see .

- There are significant changes to the way scoped type variables work, and some programs that used to compile may no longer do so. The new story is documented in . ( Simon's e-mail gives some background, but the user manual should be complete (tell us if not), and certainly takes precedence if there is any conflict.)

- GHC now supports bang patterns to require a function is strict in a given argument, e.g.

          f (!x, y) = [x,y]

  is equivalent to

          f (x, y) | x `seq` False = undefined
                   | otherwise = [x,y]

  See for more details.

- The restriction that you cannot use two packages together if they contain a module with the same name has been removed. In implementation terms, the package name is now included in every exported symbol name in the object file, so that modules with the same name in different packages do not clash. See .

- GHC now treats source files as UTF-8 (ASCII is a strict subset of UTF-8, so ASCII source files will continue to work as before). However, invalid UTF-8 sequences are ignored in comments, so ASCII code with comments in, for example, Latin-1 will also work.

  A way to have Latin-1 source files pre-processed by GHC is described in .

- GADTs can now use record syntax. Also, if the datatype could have been declared with Haskell 98 syntax then deriving clauses are permitted. For more info see .

- There is a new pragma `LANGUAGE` which allows extensions to be specified portably, i.e. without having to resort to the `OPTIONS_GHC` pragma and giving GHC-specific options. The arguments to the pragma are the same extensions that Cabal knows about. More info in .

- When you use `ghc --make`, GHC will now take the executable filename from the name of the file containing the `Main` module rather than using `a.out`. The `.exe` extension is appended on Windows, and it can of course be overridden with `-o`.

- GHC's garbage collector now deals more intelligently with mutable data, so you mostly no longer need to worry about GC performance when a lot of memory is taken up by `STArray`s, `IOArray`s, `STRef`s or `IORef`s. For more details see trac bug #650.

- GHC now allows more generalisation when typing mutually recursive bindings, resulting in more programs being accepted. See for more details.

- The rules for instance declarations have been further relaxed. You are now permitted to have instances whose heads contain only type variables, e.g.

          instance C a

  and instances whose constraints are not only type variables, e.g.

          instance C2 Int a => C3 [a] b

  For more details, see .

- The following flags (and, where appropriate, their inverses) used to be static (can only be given on the command line) but are now dynamic (can also be given in a `GHC_OPTIONS` pragma or with `:set` in GHCi): `-c`, `-hcsuf`, `-hidir`, `-hisuf`, `-o`, `-odir`, `-ohi`, `-osuf`, `-keep-hc-file`, `-keep-s-file`, `-keep-raw-s-file`, `-keep-tmp-files`, `-tmpdir`, `-i`, `-package`, `-hide-package`, `-ignore-package`, `-package-conf`, `-no-user-package-conf`, `-fcontext-stack`, `-fexcess-precision`, `-fignore-asserts`, `-fignore-interface-pragmas`, `-I`, `-framework`, `-framework-path`, `-l`, `-L`, `-main-is`, `-no-hs-main`, `-split-objs`, `-pgmL`, `-pgmP`, `-pgmc`, `-pgma`, `-pgml`, `-pgmdll`, `-pgmF`, `-optl`, `-optdll`, `-optdep`, `-fno-asm-mangling`. See for more on the meaning of static and dynamic flags, and for more on the flags themselves.

- There is a new flag `-x` for overriding the default behaviour for source files; see details.

- The `-no-recomp`
  option is now called `-fforce-recomp`
  . (the old name is still accepted for backwards compatibility, but will be removed in the future).

- The `-fglobalise-toplev-names` flag has been removed.

- The `-fallow-overlapping-instances` flag is implied by the `-fallow-incoherent-instances` flag.

- The directory that the `foo_stub.c` and `foo_stub.h` files are put in can now be controlled with the `-stubdir` flag. See for more details.

- When the `-fno-implicit-prelude` is given, the equality test performed when pattern matching against an overloaded numeric literal now uses the `(==)` in scope, rather than the one from `Prelude`. Likewise, the subtraction and inequality test performed when pattern matching against `n+k` patterns uses the `(-)` and `(>=)` in scope.

- Another change to `-fno-implicit-prelude`: with the exception of the arrow syntax, the types of functions used by sugar (such as do notation, numeric literal patterns) need not match the types of the `Prelude` functions normally used.

- The `InstalledPackageInfo` syntax has changed. Now instead of `extra-libs` we have `extra-libraries`, instead of `extra-hugs-opts` we have `hugs-options`, instead of `extra-cc-opts` we have `cc-options`, instead of `extra-ld-opts` we have `ld-options`, and instead of `extra-frameworks` we have `frameworks`. See for details.

- If you `newtype` the IO monad, e.g.

          newtype MyIO a = MyIO (IO a)

  then GHC will now allow you to have FFI calls return `MyIO t` rather than just `IO t`. See

- GHC's mechansim for deriving user-defined classes for newtypes has been further generalised, to multi-parameter type classes and higher-kinded types. See .

- By default, pattern bindings in GHC are now monomorphic. This means that some valid Haskell 98 programs will get rejected, but we believe they will be few in number. To revert to the old behaviour use the `-fno-mono-pat-binds` flag. More details are in .

- GHCi already does more defaulting than Haskell 98 so that, for example, `reverse []` shows a result rather than giving an ambiguous type variable error. There is now a flag `-fextended-default-rules` to use these defaulting rules with GHC too. More details are in .

- You can now give both class and instance declarations in `.hs-boot` files. More details in .

- Linear implicit parameters have been scheduled for removal for some time. In 6.6 we've removed them from the user manual, and they may well disappear from the compiler itself in 6.6.1.

- If the program is idle for a certain amount of time then GHC will now take the opportunity to do a major garbage collection. The amount of idle time that is required before that happens is controlled by the new `-I` RTS flag. There is more detail in .

- It is now possible to control the frequency that the RTS clock ticks at with the new `-V` RTS flag. This is normally handled automatically by other flags, but this flag is needed if you want to increase the resolution of the time profiler. For more details see .

- The old syntax for FFI declarations (deprecated since 5.04) is no longer accepted.

- The `-split-objs` flag, which when used to compile libraries means executables using the library will be smaller, can now be used with `--make` and hence can be used by cabal. See for more information.

- Template Haskell used to have limited support for type signatures in patterns, but since that design is in flux for Haskell (let alone Template Haskell), we've removed type signatures in patterns from Template Haskell.

- GHC now supports postfix operators, as a simple generalisation of left sections ().

- Parallel arrays, as enabled by `-fparr`, no longer work. They'll be coming back shortly, in full glory.

## GHCi changes

- GHCi now allows tab completion of in-scope names and modules on platforms that use readline (i.e. not Windows).

- GHCi now has a `:main` command that allows you to call the `main` function with command-line arguments. See for more information.

- GHCi now has `:ctags` and `:etags` commands to generate tags files for vi-style and emacs-style editors respectively. See for more information.

- GHCi now has an `:edit` command which pops up an editor on the most recently loaded file, or a specified file. See for more information.

- GHCi now invokes `print` by default on the result of IO actions and bindings at the prompt. This is occasionally not what you want, so it can be disabled (at least for bindings) with `:set -fno-print-bind-result`. See .

## Libraries

Libraries are now divided into core libraries (those that are necessary to build GHC) and extra libraries. Decoupling the extra libraries means that they can release independently of GHC releases, and makes development builds of GHC quicker as they no longer need to build unnecessary libraries.

The hslibs libraries have finally been removed.

## Core Libraries

### base

- Version number 2.1 (was 1.0).

- We now have `Read` and `Show` instances for up to 15-tuples (used to be up to 5-tuples).

- New module `Control.Applicative` that describes a structure intermediate between a functor and a monad: it provides pure expressions and sequencing, but no binding.

- `Control.Exception` now exports `bracketOnError`, which behaves like `bracket` but only runs the final action if the main action raised an error.

- There is a new module `Control.Monad.Instances` which provides `Monad` and `Functor` instances for `((->) r)` (were in `mtl`'s `Control.Monad.Reader`), a `Functor` instance for `(Either a)` (was in `mtl`'s `Control.Monad.Error`) and a `Functor` instance for `((,) a)` (new).

- The `MonadFix` instance for `((->) r)` is now in `Control.Monad.Fix` (was in `mtl`'s `Control.Monad.Reader`).

- `Control.Monad.ST` now exports `unsafeSTToIO`.

- The `HasBounds` class has been removed from `Data.Array.Base`, and its `bounds` method is now in the `IArray` class. The `MArray` class has also gained a method `getBounds`.

- `Data.Array.Base` now provides an `MArray (STArray s) e (Lazy.ST s)` instance.

- `Data.Array.Storable` now exports a function `unsafeForeignPtrToStorableArray`.

- The new `Data.ByteString` hierarchy provides time and space-efficient byte vectors. The old `Data.PackedString` module is now deprecated as a result, although there is not yet a replacement if you need full unicode support.

- `GHC.Exts` now provides a function `inline` which, provided the RHS is visible to the compiler, forcibly inlines its argument. Otherwise, it acts like `id`. For more details, see .

- `GHC.Exts` now provides a function `lazy`, where `lazy f` behaves like `f`, except GHC is forced to believe that it is lazy in its first argument. For more details, see .

- `Data.FiniteMap` has been removed (deprecated since 6.4). Use `Data.Map` instead.

- `Data.Char` now exports `isLetter`, `isMark`, `isNumber`, `isPunctuation`, `isSymbol`, `isSeparator`, `isAsciiUpper`, `isAsciiLower` and `toTitle`. It also exports a function `generalCategory` that tells you the category of a character in terms of a datatype `GeneralCategory`.

- `Data.Dynamic` now exports a function `dynTypeRep`.

- There is a new module `Data.Eq` which just exports the `Eq` class. Likewise, a new module `Data.Ord` exports the `Ord` class, as well as the handy `comparing` function.

- There is a new module `Data.Fixed` providing fixed-precision arithmetic.

- There is a new module `Data.Foldable` providing a class for foldable datatypes. It gives instances for `Maybe`, `[]` and `Array i`.

- There is a new module `Data.Traversable` providing a class for data structures that can be traversed from left to right. It gives instances for `Maybe`, `[]` and `Array i`.

- `Data.FunctorM` has been deprecated; use `Data.Foldable` and `Data.Traversable` instead.

- The `toConstr` definitions for tuples in `Data.Generics.Instances` now actually evaluate their arguments to tuples before returning anything.

- `Data.IntMap` now exports `notMember`, `alter`, `mapMaybe`, `mapMaybeWithKey`, `mapEither` and `mapEitherWithKey`. It also has `Monoid`, `Foldable` and `Read` instances.

- `Data.IntSet` now exports `notMember`. It also has `Monoid` and `Read` instances.

- `Data.Map` now exports `notMember`, `alter`, `mapMaybe`, `mapMaybeWithKey`, `mapEither`, `mapEitherWithKey`, `minView` and `maxView`. It also has `Monoid`, `Traversable`, `Foldable` and `Read` instances.

- `Data.Set` now exports `notMember`, `minView` and `maxView`. It also has `Monoid`, `Foldable` and `Read` instances.

  The old, deprecated (since 6.4) interface consisting of `emptySet`, `mkSet`, `setToList`, `unitSet`, `elementOf`, `isEmptySet`, `cardinality`, `unionManySets`, `minusSet`, `mapSet`, `intersect`, `addToSet` and `delFromSet` has been removed.

- `Data.Monoid` no longer contains the `Monoid` instances for `Map`, `IntMap`, `Set` and `IntSet`. They have been moved to their own modules, as above. The `(a -> a)` instance has been replaced with a `Monoid b => Monoid (a -> b)` instance. The module also now exports `Dual`, `Endo`, `All`, `Any`, `Sum` and `Product` types, and `Monoid` instances for them.

- There is a new module `Data.Sequence` for finite sequences. The `Data.Queue` module is now deprecated in favour of this faster, more featureful replacement.

- `Data.Tree` now has `Data`, `Typeable`, `Traversable` and `Foldable` instances for the `Tree` datatype.

- `Data.Typeable` now uses `-fallow-overlapping-instances`, so the generic instances can be overriden for your own datatypes.

- `Debug.Trace` now exports `traceShow`, which is the same as `trace` except its first argument can be any showable thing rather than being required to be a string.

- `Foreign.C.Types` now also defines `CIntPtr`, `CUIntPtr`, `CIntMax` and `CUIntMax`.

- `Foreign.ForeignPtr` now exports `FinalizerEnvPtr`, `newForeignPtrEnv` and `addForeignPtrFinalizerEnv`. Together, these allow the use of finalizers which are passed an additional environment parameter.

- `Foreign.Marshal.Utils` no longer exports the `withObject` function, deprecated since 5.04; use `with` instead.

- Foreign.Ptr now also defines `IntPtr`, `ptrToIntPtr`, `intPtrToPtr`, `WordPtr`, `ptrToWordPtr` and `wordPtrToPtr`.

- There are now `Bounded` instances for up to 15-tuples (used to be up to 4-tuples).

- The `Text.Html` and `Text.Html.BlockTable` modules have now been removed, with the new `html` and `xhtml` packages providing replacements.

- `Text.Read` now exports a function `parens` which parses a value in an arbitrary number of parentheses.

- The `ForeignPtr` datatype has been altered to make it more efficient. There are also new functions `mallocPlainForeignPtr` and `mallocPlainForeignPtrBytes` which do not allow you to attach a finalizer to the `ForeignPtr`.

- The `Text.Regex` and `Text.Regex.Posix` modules have been removed. Instead, use the new `regex-compat` package for a drop-in `Text.Regex` replacement, or the new library in the new `regex-posix` package.

### Cabal

- Version number 1.1.6 (was 1.1.4).

- Support for JHC, symmetric to the support for the other implementations, has been added throughout.

- Support for object splitting and building in-place has been added throughout.

- Added a `debianTemplate` directory with templates for building Debian packages from Cabal packages.

- There are now modules `Distribution.Simple.compiler` for each of `GHC`, `NHC`, `Hugs` and `JHC`. The `Distribution.Simple.Build` and `Distribution.Simple.Install` modules have shrunk correspondingly.

- `Distribution.GetOpt` is no longer a visible module.

- `Distribution.Simple` exports a function `defaultMainArgs`, which is identical to `defaultMain` except that the arguments are given as a list of strings rather than being retrieved with `getArgs`.

- `Distribution.Simple.Configure` no longer exports `LocalBuildInfo`, but does now export `configDependency` and `configCompilerAux`.

- `Distribution.Simple.LocalBuildInfo` now exports `mkHaddockDir`, `distPref`, `srcPref`, `autogenModulesDir` and `mkIncludeDir`.

- `Distribution.PackageDescription` now exports `haddockName`.

- `Distribution.Simple.Utils` now exports `copyDirectoryRecursiveVerbose`, `dirOf`, `distPref`, `haddockPref` and `srcPref`. It no longer exports `mkGHCiLibName`.

### haskell98

- No change (version 1.0).

### parsec

- Version number 2.0 (was 1.0).

- No other change.

### readline

- No change (version 1.0).

### regex-base

- Version 0.71.

- New library that provides common functions for different regex backends.

### regex-compat

- Version 0.71.

- New package providing a replacement `Text.Regex` module.

### regex-posix

- Version 0.71.

- A new package providing POSIX regexes.

### stm

- Version number 2.1 (was 1.0).

- A new module `Control.Monad.STM` contains the `MonadPlus` instance for `STM` and the function `check` (both used to be in `Control.Concurrent.STM`). It also re-exports `STM`, `atomically`, `retry`, `orElse` and `catchSTM`.

- A new module `Control.Concurrent.STM.TArray` defines `TArray`, a transactional array, and makes it an instance of `MArray`.

- `Control.Concurrent.STM.TChan` now provides a function `newTChanIO`, which allows `TChan`s to be created in the IO monad. Similarly, `Control.Concurrent.STM.TMVar` provides `newTMVarIO` and `newEmptyTMVarIO`, and `Control.Concurrent.STM.TVar` exports `newTVarIO`.

- `Control.Concurrent.STM.TVar` exports `registerDelay`.

- The `Control.Concurrent.STM` module has been updated to re-export all the new modules.

### template-haskell

- Version number 2.0 (was 1.0).

- A `Show` instance is now derived for `Info`, `Fixity` and `FixityDirection` in `Language.Haskell.TH.Syntax`.

- In `Language.Haskell.TH.Syntax`, there is a type `PkgName` and functions `mkPkgName` and `pkgString` for dealing with package names.

- The `patGE` function in `Language.Haskell.TH.Lib` now takes the final expression separately to the list of statements rather than splitting it off itself.

### unix

- No change (version 1.0).

### Win32

- Version number 2.1 (was 1.0).

- Now maintained by Esa Ilari Vuokko.

- There is a new module `System.Win32.Console` providing an interface to the Windows Console API.

- There is a new module `System.Win32.DebugApi` providing an interface to the Windows DebugApi.

- There is a new module `System.Win32.FileMapping` for working with memory-mapped files.

- There is a new module `System.Win32.SimpleMAPI` for using the Windows mail API.

- There is a new module `System.Win32.Time` for using the Windows time API.

- `iNVALID_HANDLE_VALUE` has moved from `Graphics.Win32.Misc` to `System.Win32.Types`.

- `System.Win32.File` has a new function `getFileInformationByHandle` and associated data types.

- `System.Win32.Info` has a new function `getSystemInfo` and associated data types.

- `System.Win32.Process` now has many more exports.

- `System.Win32.Types` has new types `LARGE_INTEGER`, `DDWORD` and `SIZE_T`. It also has new helper functions `ddwordToDwords` and `dwordsToDdword` to split and combine ddwords into high and low components.

- `System.Win32` re-exports `System.Win32.FileMapping`, `System.Win32.Time` and `System.Win32.Console`.

## Extra Libraries

### ALUT

- Version number 2.0 (was 1.0).

- `Sound.ALUT.BuiltInSounds` has been removed. Its `Phase` and `Duration` exports are now exported by `Sound.ALUT.Loaders` and its `helloWorld`, `sine`, `square`, `sawtooth`, `impulse` and `whiteNoise` exports are now constructors of the `Sound.ALUT.Loaders.SoundDataSource` datatype.

### arrows

- Version number 0.2 (was 0.1).

- `Control.Sequence` has been removed in favour of the new `Control.Applicative` module in `base`.

### cgi

- Version 2006.8.14.

- `cgi` is a new package, developing on what used to be `Network.CGI` in the `network` package.

- The `Network.CGI.Compat` module provides a similar interface to the old `Network.CGI` module, but it uses `Text.XHtml` rather than `Text.Html`.

### fgl

- Version number 5.3 (was 5.2).

- `Data.Graph.Inductive.Graph` no longer exports `UContext`.

- `Data.Graph.Inductive.Graph` now exports `delLEdge`.

### GLUT

- Version number remains 2.0.

- In `Graphics.UI.GLUT.Initialization`, `DisplayMode` has a new constructor `WithAuxBuffers` and `DisplayCapability` has a new constructor `DisplayAux`. These represent freeglut-only features.

- There are new examples in `BOGLGP/Chapter03/OnYourOwn1.hs`, `RedBook/AAIndex.hs`, `RedBook/AARGB.hs`, `RedBook/AccAnti.hs`, `RedBook/AccPersp.hs`, `RedBook/Alpha3D.hs`, `RedBook/DOF.hs`, `RedBook/FogIndex.hs`, `RedBook/Multisamp.hs`, `RedBook/PointP.hs`, `RedBook/PolyOff.hs`, `RedBook/Stencil.hs`, `RedBook/Stroke.hs` and `RedBook/Torus.hs`, and the examples in `RedBook/Font.hs` and `RedBook/Histogram.hs` have been improved.

### haskell-src

- No change (version 1.0).

### HGL

- No change (version 3.1).

### html

- Version 1.0.

- `html` is a new package, developing on what used to be `Text.Html` and `Text.Html.BlockTable` in the `base` package.

- `Text.Html.BlockTable` exports a new function `empty`.

### HUnit

- No change (version 1.1).

### mtl

- No change (version 1.0).

### network

- Version number 2.0 (was 1.0).

- `Network.CGI` has been removed; use the `cgi` package instead.

- `Network.BSD` no longer exports `symlink` or `readlink`; use `System.Posix.Files.createSymbolicLink` and `System.Posix.Files.readSymbolicLink` instead.

- `Network.BSD` now exports `defaultProtocol`.

- `Network.Socket.SocketStatus` now has a constructor `ConvertedToHandle` for sockets that have been converted to handles.

- `Network.Socket.Family` now has the following additional constructors: `AF_NETROM`, `AF_BRIDGE`, `AF_ATMPVC`, `AF_ROSE`, `AF_NETBEUI`, `AF_SECURITY`, `AF_PACKET`, `AF_ASH`, `AF_ECONET`, `AF_ATMSVC`, `AF_IRDA`, `AF_PPPOX`, `AF_WANPIPE` and `AF_BLUETOOTH`.

- In `Network.URI`, `parseabsoluteURI` has been deprecated with a new function `parseAbsoluteURI` taking its place.

### ObjectIO

- No change (version 1.0).

### OpenAL

- Version number 1.3 (was 1.2).

- No other change.

### OpenGL

- Version number 2.1 (was 2.0).

- No other change.

### QuickCheck

- No change (version 1.0).

### time

- Version 1.0.

- `time` is a new package, for dealing with dates, times and time intervals.

### X11

- Version number 1.2 (was 1.1).

- In `Graphics.X11.Xlib.Types`, `XGCValues` has been renamed `GCValues` and `XSetWindowAttributes` has been renamed `SetWindowAttributes`.

- In `Graphics.X11.Xlib.Misc`, `allocaXSetWindowAttributes` has been renamed `allocaSetWindowAttributes`.

- The `FontStruct` type has moved from `Graphics.X11.Xlib.Types` to `Graphics.X11.Xlib.Font`.

- The `Point`, `Rectangle`, `Arc`, `Segment` and `Color` types in `Graphics.X11.Xlib.Types` are now proper datatypes rather than synonyms for tuples. They all have a `Storable` instance.

- The `Byte` and `Short` types from `Graphics.X11.Xlib.Types` have been removed. The following type synonyms, which had already been marked "Backwards compatibility", have also been removed: `ListPoint`, `ListRectangle`, `ListArc`, `ListSegment` and `ListColor`.

- `Eq`, `Ord`, `Show`, `Typeable` and `Data` are now derived for: `XEvent`, `FdSet` and `TimeZone` in `Graphics.X11.Xlib.Event`, `FontStruct` in `Graphics.X11.Xlib.Font`, `XErrorEvent`, `XComposeStatus` and `XTextProperty` in `Graphics.X11.Xlib.Misc`, `Region` in `Graphics.X11.Xlib.Region`, `Display`, `Screen`, `Visual`, `GC`, `GCValues`, `SetWindowAttributes`, `Point`, `Rectangle`, `Arc`, `Segment` and `Color` in `Graphics.X11.Xlib.Types`.

### xhtml

- Version 2006.8.14.

- `xhtml` is a new package, developing on what used to be `Text.Html` and `Text.Html.BlockTable` in the `base` package.

## GHC As A Library

Version number 6.6.

The internal modules of GHC are now available as a library, package name `ghc`. The interface has not been designed with use by other programs in mind, so expect the API to vary radically in future releases.

An introduction to using the library can be found on the wiki.

## Internal changes

- GHC development now has its own integrated wiki and bug tracker.

- GHC has now moved to darcs. See the wiki for more details. The sources have moved around a bit within the tree as a result, most notably the GHC sources are no longer kept within a `ghc/` subdirectory.

- The native code generator is now capable of compiling loops, which gets us a big step closer to being able to compile entirely without gcc on well-supported arches.