2.1. Version 9.6.1

2.1.1. Language

  • Record updates for GADTs and other existential datatypes are now fully supported.

    For example:

    data D b where
      MkD :: { fld1 :: a -> a, fld2 :: a -> (), fld3 :: b } -> D b
    foo :: D b -> D b
    foo d = d { fld1 = id, fld2 = const () }

    In this example, we have an existential variable a, and we update all fields whose type involves a at once, so the update is valid.

    A side-effect of this change is that GHC now rejects some record updates involving fields whose types contain type families (these record updates were previously erroneously accepted).


    type family F a where
      F Int   = Char
      F Float = Char
    data T b = MkT { x :: [Int], y :: [F b] }
    emptyT :: forall b. T b
    emptyT = MkT [] []
    bar :: T Int
    bar = emptyT { x = [3] }

    In this example, we can’t infer the type of emptyT in bar: it could be T Int, but it could also be T Float because the type family F is not injective and T Float ~ T Int. Indeed, the following typechecks

    baz :: T Int
    baz = case ( emptyT :: T Float ) of { MkT _ y -> MkT [3] y }

    This means that the type of emptyT is ambiguous in the definition of bar above, and thus GHC rejects the record update:

    Couldn't match type `F b0' with `Char'
    Expected: [F Int]
      Actual: [F b0]
    NB: ‘F’ is a non-injective type family
    The type variable ‘b0’ is ambiguous

    To fix these issues, add a type signature to the expression that the record update is applied to (emptyT in the example above), or add an injectivity annotation to the type family in the case that the type family is in fact injective.

2.1.2. Compiler

2.1.3. base library

  • Exceptions thrown by weak pointer finalizers are now caught and reported via a global exception handler. By default this handler reports the error to stderr although this can be changed using GHC.Weak.Finalize.setFinalizerExceptionHandler.
  • GHC now provides a set of operations for introspecting on the threads of a program, GHC.Conc.listThreads, as well as operations for querying a thread’s label (GHC.Conc.threadLabel) and status (GHC.Conc.threadStatus).

2.1.4. ghc-prim library

2.1.5. ghc library

2.1.6. ghc-heap library Included libraries

The package database provided with this distribution also contains a number of packages other than GHC itself. See the changelogs provided with these packages for further change information.

Package Version Reason for inclusion
ghc 9.5 The compiler itself
Cabal-syntax Dependency of ghc-pkg utility
Cabal Dependency of ghc-pkg utility
Win32 Dependency of ghc library
array Dependency of ghc library
base Core library
binary Dependency of ghc library
bytestring Dependency of ghc library
containers Dependency of ghc library
deepseq Dependency of ghc library
directory Dependency of ghc library
exceptions 0.10.5 Dependency of ghc and haskeline library
filepath Dependency of ghc library
ghc-boot-th 9.5 Internal compiler library
ghc-boot 9.5 Internal compiler library
ghc-compact Core library
ghc-heap 9.5 GHC heap-walking library
ghc-prim 0.9.0 Core library
ghci 9.5 The REPL interface
haskeline 0.8.2 Dependency of ghci executable
hpc Dependency of hpc executable
integer-gmp 1.1 Core library
libiserv 9.5 Internal compiler library
mtl 2.2.2 Dependency of Cabal library
parsec Dependency of Cabal library
pretty Dependency of ghc library
process Dependency of ghc library
stm Dependency of haskeline library
template-haskell Core library
terminfo Dependency of haskeline library
text 2.0 Dependency of Cabal library
time 1.12.2 Dependency of ghc library
transformers Dependency of ghc library
unix Dependency of ghc library
xhtml 3000.2.2.1 Dependency of haddock executable