When upgrading to GHC 6.10, any of your packages that worked against
the base-3 library will continue to work (unless you define instances of the Arrow class: see below). GHC 6.10 provides both the old
base-3 library and the new base-4.

To ensure your old code continues to work, you can have the code compile
and link against base-3, and then, over time, migrate code to the base-4
series.

1 Adding base-3 constraints

How to do this depends on how you build your Haskell code. We'll start
with the most simplistic build mechanisms. cabal-install, the most
sophisticated tool, will sort this all out for you anyway, so things
should change.

1.1 ghc --make

Force use of package base-3 when using --make,

ghc --make -package base-3.0.3.0

1.2 runhaskell

If you build your packages with the 'runhaskell Setup.hs configure'
method, then you can force the use of base-3,

--constraint="base<4"

1.3 cabal-install

It is worth upgrading cabal-install immediately (maybe before installing
GHC). This way you can use the smart dependency solver to work out what
to install for you.

Each of these has a standard way to solve the problem. Techniques should be attached here.

2.1 Arrow instances

The relevant change is essentially that Arrow became a subclass of Category. To be exact:

(.) is a new function, in Category. (>>>) was removed from Arrow and made a function.

id is a new function, in Category

The base-3 compatibility package contains the same classes as base-4, so it will not save you if you define instances of the Arrow class: you'll need to change your code.
Whenever you define an instance of Arrow you must also define an instance of Category, as follows:

2.2 Return types of Map and Set functions

If you assume the more specific type, your code will work with both old and new versions of the containers package.
The brute force approach is to change each lookup k m to

fromMaybe (fail"lookup: key not found")$lookup k m

but you could also consider how you want to handle possible failures, or at least give a more informative error message.

2.3 Exception handling changes

The exception system was generalised in GHC 6.10, but GHC 6.10 still provides base-3, so all your applications can continue to work.

Follow the steps for compiling against base-3 at the top of the page, based on your build system.

Note that if you use cabal-install, it is smart enough to work this out for you.

2.4 Changes to -fvia-C and headers

GHC 6.10 no longer includes extra header files when compiling with -fvia-C. This makes compilation with -fvia-C consistent with the native code generator.

As a consequence, defining inline functions in header files and relying on -fvia-C to pick them up no longer works. Similarly calling C 'functions' that are actually defined via CPP macros also does not work.

If you use a library that provides inline functions that you want to use, you will have to create wrapper functions to use them via FFI.

If you use the #def feature of hsc2hs, you can no longer define inline functions. That is, replace #def inline void foobar() { ... } by just #def void foobar() { ... }

Beware: In some cases, a library using inline functions will be built successfully, but programs using the library will fail to build.

2.5 Changes to RULES parsing

RULES are now always parsed and checked. No ghc flags or language extensions are required. (Note: the first 6.10 RC had a bug in this area)

RULES are only exported if the defining module is built with -O. This is the same as for other cross-module optimisations like exporting the bodies of inlinable functions.

2.6 Changes to GADT matching

GHC now enforces the rule that in a GADT pattern match:

the type of the scrutinee must be rigid

the result type must be rigid

the type of any variable free in the case branch must be rigid

Here "rigid" means "fully known to the compiler, usually by way of a type signature". This rule is to make type inference simple and predictable.

Observe that this means that GHC must know the result type of the match at the match point. There is no workaround other than finding a way to provide enough annotations in order to make GHC happy. Nevertheless, this heuristic was suggested:

My general method for solving these problems was to find an expression
or statement that enclosed both the left and right hand sides, and add
:: Int to it. I then recompiled and got an error message saying it
couldn't match Int with "something". I then replaced Int with
"something" and it worked.

In any case, this thread is probably a must-read if you are running into this.

2.7 No more GHC.Prim

It is no longer possible to import GHC.Prim, instead, GHC.Exts should be used to get at the compiler's primops.

3 Backwards compatibility

The new, suggested Cabal version range syntax,

build-depends: base-3.*

is not backwards compatible with older versions of Cabal. Users will need to upgrade to the newer Cabal to build packages that start using this syntax.

4 GHC API changes

For converting a package that uses GHC-API, see [GhcApiStatus] for notes on the changes to the API and its use in 6.10. There are four main changes:

add imports 'MonadUtils' and 'SrcLoc'

use of 'runGhc' instead of newSession

code using getSession and related, converts to become monadic within Ghcmonad