1.6. Release notes for version 6.8.1

The significant changes to the various parts of the compiler are listed in the following sections.

The major changes in this release are adding Haskell Program Coverage (hpc) support to the compiler, adding a debugger to GHCi, the first phase of the base package split, and pointer tagging in the code generator (which should mean most code improves by 10-15%, and as a result the compiler is also faster).

1.6.1. User-visible compiler changes

  • The GHC version numbering policy has been changed so 6.8.1 is the first release in this branch; see Section 1.3, “GHC version numbering policy” for details.

  • Registerised builds with gcc >= 4.2 now work.

  • While older releases did mostly work on Windows Vista, 6.8.1 fixes some issues, e.g. Windows used to think that cabal Setup programs were installers and refused to run them. However, Win9x support has now officially been dropped, as we are not able to test on that platform.

  • Haskell Program Coverage Adding hpc tools, as a single program GHC now comes with “Haskell Program Coverage”, a code coverage tool. This is in the form of a new -fhpc flag and an hpc program. See Section 6.6, “Observing Code Coverage” for more details.

  • There is the beginnings of support for “associated types” in GHC. However, this is incomplete and not a supported feature.

  • There is the beginnings of support for “nested data parallelism” in GHC. However, this is incomplete and not a supported feature.

  • It is now possible to derive class instances with standalone top-level declarations, rather than having to attach a deriving clause to the datatype declaration. The syntax is

    deriving instance Cxt => Head

    For more details see Section 8.5.2, “Stand-alone deriving declarations”.

  • GHC now does left-to-right impredicative instantiation, so for example

    runST $ foo

    will now work. Don't rely on this, though, as it is subject to change in the future!

  • A new extension OverloadedStrings means that string literals have type

    Data.String.IsString t => t

    where Data.String.IsString is a new class with a single method

    fromString :: String -> a

  • There is a new record field disambiguation extension, enabled by -fdisambiguate-record-fields, which allows normally-ambiguous field names to be used when it is clear which is meant due to the use of a constructor. See Section 8.3.7, “Record field disambiguation” for more details.

  • There are also new flags -frecord-puns and -frecord-dot-dot for record punninng, but these do not work correctly yet, and so are not supported.

  • GHC now has an --info flag which prints information about the settings used to build the compiler. The information is in a machine-parsable (Haskell) format. For example,

    $ ghc --info           
     [("Project name","The Glorious Glasgow Haskell Compilation System")
     ,("Project version","6.8.1")
     ,("Booter version","6.6")
     ,("Stage","2")
     ,("Interface file version","6")
     ,("Have interpreter","YES")
     ,("Object splitting","NO")
     ,("Have native code generator","YES")
     ,("Support SMP","YES")
     ,("Unregisterised","NO")
     ,("Tables next to code","YES")
     ,("Win32 DLLs","")
     ,("RTS ways"," debug  thr thr_p thr_debug")
     ,("Leading underscore","NO")
     ]

  • The runtime system now has an --info flag which prints various information about the way it was compiled. Thus you can give +RTS --info flags to any Haskell program, e.g.

    $ darcs +RTS --info
     [("GHC RTS", "Yes")
     ,("GHC version", "6.8.1")
     ,("RTS way", "rts_thr")
     ,("Host platform", "x86_64-unknown-linux")
     ,("Build platform", "x86_64-unknown-linux")
     ,("Target platform", "x86_64-unknown-linux")
     ,("Compiler unregisterised", "NO")
     ,("Tables next to code", "YES")
     ]

  • GHC now accepts -XFoo and -XNoFoo flags, where Foo is any extension that can be listed in a LANGUAGE pragma. As a result the following flags are now deprecated:

    • -fth (use -XTemplateHaskell)

    • -ffi, -fffi (use -XForeignFunctionInterface)

    • -farrows (use -XArrows)

    • -fgenerics (use -XGenerics)

    • -fimplicit-prelude (use -XImplicitPrelude)

    • -fbang-patterns (use -XBangPatterns)

    • -fmonomorphism-restriction (use -XMonomorphismRestriction)

    • -fmono-pat-binds (use -XMonoPatBinds)

    • -fextended-default-rules (use -XExtendedDefaultRules)

    • -fimplicit-params (use -XImplicitParams)

    • -fscoped-type-variables (use -XScopedTypeVariables)

    • -fparr (use -XPArr)

    • -fallow-overlapping-instances (use -XOverlappingInstances)

    • -fallow-undecidable-instances (use -XUndecidableInstances)

    • -fallow-incoherent-instances (use -XIncoherentInstances)

  • GHC now has a --supported-languages flag which lists the strings it understands as a -X flag and in a LANGUAGE pragma. You can prepend NO to any of the strings. LANGUAGE pragmas also only turn on exactly what you asked for now; many of them used to just enable -fglasgow-exts before.

  • GHC now understands GENERATED pragmas, which are used to indicate to tools like HPC where some tool-generated code came from. They look like

    {-# GENERATED "SourceFile" 12:3-14:8 #-} expr

  • GHC now has a --print-docdir flag which prints to stdout where GHC believes its documentation is located.

  • The -O no longer enables -fvia-C.

  • There is a new flag -fobject-code, which uses the default of -fasm or -fvia-C, and -fbyte-code, which only works in GHCi and sets byte-code as the target.

  • The warning for importing T(..) when T is an abstract type used to be enabled only by -W or -Wall. It no has its own flag -fwarn-dodgy-imports.

  • A new flag -fwarn-tabs warns if there are tab characters in your source files.

  • A new flag -fwarn-implicit-prelude warns if your module implicitly imports the Prelude.

  • A new flag -fwarn-monomorphism-restriction warns if the monomorphism restriction applies to your code.

  • The “missing type-signature” warning now tells you what type GHC inferred for the function.

  • The -w flag now turns off all options, not just those that are enabled by -Wall.

  • A new flag -Wwarn makes warnings just warn (the default). It can be used to override -Werror.

  • The -keep-hc-file, -keep-s-file and -keep-raw-s-file flags can now have an s appended to their name (which reads better when using --make). None of them, nor -keep-tmp-files, can have any other suffix.

  • There is a new flag -fspec-threshold which subsumes the now-deprecated -fliberate-case-threshold.

  • A new flag -fprint-explicit-foralls controls whether or not GHC prints explicit foralls when printing types.

  • A new flag -ddump-to-file allows you to specify that the output of the various ddump flags should be put in a given file.

  • A new flag -ddump-rule-firings makes GHC print out when its RULEs fire.

  • A new flag -ddump-mod-cycles, used with the -M mode, make GHC print out any module import loops.

  • The -fasm flag no longer takes an argument (which it always used to ignore anyway).

  • The new -fhardwire-lib-paths flag means the path to libraries are baked in, using the -rpath linker option.

  • A new RTS flag +RTS --install-signal-handlers=>yes|no< tells the RTS whether or not to install signal handlers (default is yes). When making a DLL you will probably want to set this to no.

  • When using runghc you can now leave a space after the -f argument telling it where to find GHC. You can now use -- to separate the -f argument from the GHC arguments, and the GHC arguments from the program to run.

  • ghc-pkg has a new command check which prints a list of all packages that are broken and which dependencies they are missing. Additionally, the list command now puts braces around broken packages.

  • ghc-pkg now has a new flag --names-only, used in conjunction with list --simple-output, which prints package names only, i.e. without their version numbers.

  • Some parts of the documentation, notably the building guide, have been moved to the wiki.

  • Linear implicit parameter support has been removed.

  • A new RTS flag +RTS -xbXXXXX hints to the OS that we'd like the heap to start at address 0xXXXXX. This is mainly of use to people debugging GHC.

1.6.2. Profiling changes

  • It is now possible to get basic per-constructor profiling information from programs not compiled with -prof, by using the +RTS -hT flag. This is possible even when running code in GHCi.

  • There is now support in the run-time system for using PAPI to do CPU performance counter measurements. This is controlled via the +RTS -aX options. Note that it must be enabled when the compiler is built, and is still very experimental.

  • Ticky-ticky profiling, mainly for use by GHC developers, has been revived. See Section 6.7, “Using “ticky-ticky” profiling (for implementors)” for more information.

  • It is now possible to have the key on a different page in a graph generated by hp2ps, meaning the graph can be larger and the cost centre names longer. The +RTS -L flag can be used to specify the maximum length of a cost-centre stack name.

  • Uses of _scc_ now give a deprecated warning. Use SCC pragmas instead.

1.6.3. GHCi changes

  • GHCi now includes an interactive debugger. See Section 3.5, “The GHCi Debugger” for more information.

  • The GHCi startup banner has been replaced with a single line. Avid fans of the banner can add

    putStrLn "   ___         ___ _"
    putStrLn "  / _ \\ /\\  /\\/ __(_)"
    putStrLn " / /_\\// /_/ / /  | |   GHC Interactive, for Haskell 98."
    putStrLn "/ /_\\\\/ __  / /___| |   http://www.haskell.org/ghc/"
    putStrLn "\\____/\\/ /_/\\____/|_|   Type :? for help."
    putStrLn ""

    to their ~/.ghci.

  • GHCi now has () as the first type in its defaulting list. See Section 3.4.5, “Type defaulting in GHCi” for more information.

  • GHCi now treats import M at its prompt the same as :module +M.

  • As well as :set -fno<foo>, you can now also say :unset -f<foo>.

1.6.4. Boot Libraries

These used to be called “core libraries”, but we now call them “boot libraries” (or, more precisely, “GHC boot libraries”) instead.

We now build the libraries with Cabal, rather than our own build system, so it should no longer be possible for differences to creep in between the libraries as built with GHC and as built with Cabal.

The following new boot libraries have been added:

  • hpc

The following boot libraries have been removed:

  • parsec

  • regex-base

  • regex-compat

  • regex-posix

  • stm

The following boot libraries are new, but composed of modules that used to be in the base library:

  • array (Data.Array*)

  • bytestring (Data.ByteString*)

  • containers (Data.Graph, Data.IntMap, Data.IntSet, Data.Map, Data.Sequence, Data.Set, Data.Tree)

  • directory (System.Directory)

  • old-locale (System.Locale)

  • old-time (System.Time)

  • packedstring (Data.PackedString)

  • pretty (Text.PrettyPrint*)

  • process (System.Cmd, System.Process*)

  • random (System.Random)

Additionally, Control.Parallel* have been moved to a new package “parallel” which is not a boot library.

1.6.4.1. array

  • Version number 0.1 (new library, split off from base).

  • The newArray_ method returns a deterministic result in the ST monad, and behaves as before in other contexts. The old newArray_ is now called unsafeNewArray_; the MArray class therefore has one more method than before.

  • In order to avoid problems where unusual Ix instances could cause the array code to access memory it shouldn't, a number of changes have been made:

    • A method

      numElements :: Ix i => a i e -> Int

      has been added to the IArray class.

    • Data.Array.Base has a new function

      safeRangeSize :: Ix i => (i, i) -> Int

      which always returns a non-negative result.

    • Data.Array.Base has a new function

      safeIndex :: Ix i => (i, i) -> Int -> i -> Int

      which only returns a result that is non-negative and not less than its second argument.

    • The unsafeForeignPtrToStorableArray function now has an Ix i constraint.

1.6.4.2. base

  • Version number 3.0 (was 2.1.1).

  • A new function

    System.Timeout.timeout :: Int -> IO a -> IO (Maybe a)

    allows a computation to be timed out after a given number of microseconds.

  • There is a new module Data.String, which defines the new IsString(fromString) class. This class is used by the new overloaded strings extension (see Section 8.6.4, “Overloaded string literals ”).

  • The Data.List module now exports a function

    stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]

    which drops the given prefix from a list.

  • The System.IO.Error module now exports new functions ioeGetLocation and ioeSetLocation, for manipulating the “location” of an IOError.

  • The functions throwErrnoPath, throwErrnoPathIf, throwErrnoPathIf_, throwErrnoPathIfNull, throwErrnoPathIfMinus1, throwErrnoPathIfMinus1_ have moved from unix:System.Posix.Error to Foreign.C.Error.

  • The System.Posix.Signals module has moved to the unix package.

  • The Text.Printf.printf function now handles

    • The Int8, Int16, Int32, Int64, Word, Word8, Word16, Word32 and Word64 types.

    • The + flag.

    • The X, E and G formatting characters.

  • The hash functions in Data.HashTable have been improved.

  • The Kleisli composition functions

    (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
    (<=<) :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c)

    together with the combinator

    forever :: (Monad m) => m a -> m ()

    have been added to Control.Monad.

  • There is now a Monoid instance for the Maybe type.

  • Data.Monoid now includes two types First and Last, which both newtype Maybe and return the first and last Just respectively when used a a Monoid.

  • Data.Monoid.Dual now derives Eq, Ord, Read, Show and Bounded.

  • We no longer put stdin, stdout and stderr into non-blocking mode, so piping Haskell program output through programs like tee works properly.

  • The type of Data.Generics.Schemes.synthesize has been generalised from

    s -> (s -> s -> s) -> GenericQ (s -> s) -> GenericQ s

    to

    s -> (t -> s -> s) -> GenericQ (s -> t) -> GenericQ t

  • GHC.Exts now exports uncheckedShiftL64#, uncheckedShiftRL64#, uncheckedIShiftL64# and uncheckedIShiftRA64#.

  • GHC.Exts no longer defines the Splittable(split) class, which used to be used for linear implicit parameters.

  • The new value GHC.Conc.numCapabilities :: Int is the argument of the +RTS -N flag, i.e. the number of Haskell threads that can run simultaneously.

  • The new function GHC.Environment.getFullArgs returns the complete arguments that the program was invoked with, including any +RTS arguments etc.

  • GHC.Handle.openFd has been renamed to GHC.Handle.fdToHandle' to avoid confusion with System.Posix.IO.openFd.

1.6.4.3. bytestring

  • Version number 0.9 (new library, split off from base).

  • Data.ByteString.packCStringLen is no longer a pure function; its signature has changed from

    packCStringLen :: Foreign.C.String.CStringLen -> ByteString

    to

    packCStringLen :: Foreign.C.String.CStringLen -> IO ByteString

  • The Data.ByteString.Base module has been split in two. The unsafe functions are now in Data.ByteString.Unsafe (now part of the stable API), and the others are in Data.ByteString.Internal (not part of the stable API.

  • The internal lazy bytestring representation type has changed; rather than

    newtype ByteString = LPS [Strict.ByteString]

    it is now

    data ByteString = Empty | Chunk !Strict.ByteString ByteString

1.6.4.4. Cabal

  • Version number 1.2.2.0 (was 1.1.6.2).

  • Configurations have been implemented; these allow things to be set conditionally in .cabal files.

  • A new --executable flag for the haddock command also builds documentation for executables.

  • A new --hyperlink-source flag for the haddock command makes the docs link to the source code, rendered by hscolour.

  • A new --html-location flag for the haddock command allows you to say where documentation for packages we depend on is.

  • A new field pkgconfig-depends allows you to specify C libraries you use. The pkg-config command is used to find what C flags etc are needed to use this library.

  • A new field build-tools allows you to specify tool dependencies such as cpphs.

  • The includes field now only specifes which include files are automatically included when compiling the package. A new install-includes field determines which include files are also installed.

  • There are new flags --docdir and --htmldir for the configure command.

  • The configure command now has --with-prog, --prog-option and --prog-options flags for each program prog.

  • A new field cpp-options is used when preprocessing Haskell modules.

  • Many bug fixes.

  • The Cabal API is not yet stable. There have been many API changes.

1.6.4.5. containers

  • Version number 0.1 (new library, split off from base).

  • Data.Tree.Tree now has Applicative and Monad instances.

  • In Data.Map the old functions

    minView :: Monad m => Map k a -> m (Map k a, (k, a))
    maxView :: Monad m => Map k a -> m (Map k a, (k, a))

    have been replaced with

    minView :: Monad m => Map k a -> m (a, Map k a)
    maxView :: Monad m => Map k a -> m (a, Map k a)
    minViewWithKey :: Monad m => Map k a -> m ((k, a), Map k a)
    maxViewWithKey :: Monad m => Map k a -> m ((k, a), Map k a)

  • In Data.Set the old functions

    minView :: Monad m => Set a -> m (Set a, a)
    maxView :: Monad m => Set a -> m (Set a, a)

    have had their result orders reversed:

    maxView :: Monad m => Set a -> m (a, Set a)
    minView :: Monad m => Set a -> m (a, Set a)

  • The following are new functions in Data.IntMap:

    maxView                 :: Monad m => IntMap a -> m (a, IntMap a)
    minView                 :: Monad m => IntMap a -> m (a, IntMap a)
    findMin                 :: IntMap a -> a
    findMax                 :: IntMap a -> a
    deleteMin               :: IntMap a -> IntMap a
    deleteMax               :: IntMap a -> IntMap a
    deleteFindMin           :: IntMap a -> (a, IntMap a)
    deleteFindMax           :: IntMap a -> (a, IntMap a)
    updateMin               :: (a -> a) -> IntMap a -> IntMap a
    updateMax               :: (a -> a) -> IntMap a -> IntMap a
    updateMinWithKey        :: (Key -> a -> a) -> IntMap a -> IntMap a
    updateMaxWithKey        :: (Key -> a -> a) -> IntMap a -> IntMap a
    minViewWithKey          :: (Monad m) => IntMap a -> m ((Key, a), IntMap a)
    maxViewWithKey          :: (Monad m) => IntMap a -> m ((Key, a), IntMap a)

  • The following are new functions in Data.IntSet:

    findMin       :: IntSet -> Int
    findMax       :: IntSet -> Int
    deleteMin     :: IntSet -> IntSet
    deleteMax     :: IntSet -> IntSet
    deleteFindMin :: IntSet -> (Int, IntSet)
    deleteFindMax :: IntSet -> (Int, IntSet)
    maxView       :: Monad m => IntSet -> m (Int, IntSet)
    minView       :: Monad m => IntSet -> m (Int, IntSet)

1.6.4.6. directory

  • Version number 1.0 (new library, split off from base).

  • The function

    makeRelativeToCurrentDirectory :: FilePath -> IO FilePath

    has been moved from the filepath library to System.Directory.

1.6.4.7. filepath

  • Version number 1.1 (was 1.0).

  • Removed makeRelativeToCurrentDirectory (it has moved to directory:System.Directory).

  • A number of driver-related functions have been added:

                splitDrive :: FilePath -> (FilePath, FilePath)
                joinDrive  :: FilePath -> FilePath -> FilePath
                takeDrive  :: FilePath -> FilePath
                hasDrive   :: FilePath -> Bool
                dropDrive  :: FilePath -> FilePath
                isDrive    :: FilePath -> Bool

1.6.4.8. haskell98

  • Version number 1.0.1 (was 1.0).

  • No other change.

1.6.4.9. hpc

  • Version number 0.5 (new library).

1.6.4.10. old-locale

  • Version number 1.0 (new library, split off from base).

  • No other change.

1.6.4.11. old-time

  • Version number 1.0 (new library, split off from base).

  • No other change.

1.6.4.12. packedstring

  • Version number 0.1 (new library, split off from base).

  • There is now a Data instance for the PackedString type.

1.6.4.13. pretty

  • Version number 1.0 (new library, split off from base).

  • No other change.

1.6.4.14. process

  • Version number 1.0 (new library, split off from base).

  • No other change.

1.6.4.15. random

  • Version number 1.0 (new library, split off from base).

  • No other change.

1.6.4.16. readline

  • Version number 1.0.1 (was 1.0).

  • No other change.

1.6.4.17. template-haskell

  • Version number 2.2 (was 2.1).

  • We now derive Data and Typeable instances for all the TH types.

  • There is now a Functor instance for Q, and Quasi instances have a Functor constraint.

1.6.4.18. unix

  • Version number 2.2 (was 2.1).

  • System.Posix.Unistd now exports

    nanosleep :: Integer -> IO ()

    (which throws an exception if the OS doesn't provide it).

  • System.Posix.Files now exports

    fileTypeModes        :: FileMode
    blockSpecialMode     :: FileMode
    characterSpecialMode :: FileMode
    namedPipeMode        :: FileMode
    regularFileMode      :: FileMode
    directoryMode        :: FileMode
    symbolicLinkMode     :: FileMode
    socketMode           :: FileMode

    for use with functions like createDevice.

  • There is a new module System.Posix.Semaphore providing POSIX named semaphore support.

  • There is a new module System.Posix.SharedMem providing POSIX shared memory support.

  • System.Posix.Terminal now exports

    openPseudoTerminal :: IO (Fd, Fd)
    getSlaveTerminalName :: Fd -> IO FilePath

  • The functions throwErrnoPath, throwErrnoPathIf, throwErrnoPathIf_, throwErrnoPathIfNull, throwErrnoPathIfMinus1, throwErrnoPathIfMinus1_ have been removed from System.Posix.Error; they are now available from base:Foreign.C.Error.

  • The System.Posix.Signals module has been moved here from the base package.

1.6.4.19. Win32

  • Version number 2.2 (was 2.1.1).

  • There is a new module System.Win32.Security providing POSIX shared memory support.

1.6.5. GHC As A Library

  • Version number 6.8.1.

  • The API should now be much more usable than in previous releases.

  • There is a new function

    compileToCore :: Session -> FilePath -> IO (Maybe [CoreBind])

    which compiles a file to core.

  • There is a new value defaultObjectTarget that gives the HscTarget used by default. This name is now preferred to defaultHscTarget.

  • The old

    data GhcMode
      = BatchCompile
      | Interactive
      | OneShot
      | JustTypecheck
      | MkDepend

    has now been refactored into

    data GhcMode
      = CompManager -- ^ --make, GHCi, etc.
      | OneShot     -- ^ ghc -c Foo.hs
      | MkDepend    -- ^ ghc -M, see Finder for why we need this

    and

    data GhcLink = NoLink | StaticLink

    is now

    data GhcLink = NoLink | LinkBinary | LinkInMemory

  • The HsSyn types now include all of the haddock comments.

  • As the GHC API exposes all the compiler internals there are numerous other changes that is would be impractical to list, but will have little effect on users of the API.