.. _release-8-10-1: Release notes for version 8.10.1 ================================ The significant changes to the various parts of the compiler are listed in the following sections. Highlights ---------- - The :extension:`UnliftedNewtypes` extension. Full details ------------ Language ~~~~~~~~ - Kind variables are no longer implicitly quantified when an explicit ``forall`` is used, see `GHC proposal #24 `__. :ghc-flag:`-Wimplicit-kind-vars` is now obsolete. - Kind variables are no longer implicitly quantified in constructor declarations: :: data T a = T1 (S (a :: k)) | forall (b::k). T2 (S b) -- no longer accepted data T (a :: k) = T1 (S (a :: k)) | forall (b::k). T2 (S b) -- still accepted - Implicitly quantified kind variables are no longer put in front of other variables: :: f :: Proxy (a :: k) -> Proxy (b :: j) ghci> :t +v f -- old order: f :: forall k j (a :: k) (b :: j). Proxy a -> Proxy b ghci> :t +v f -- new order: f :: forall k (a :: k) j (b :: j). Proxy a -> Proxy b This is a breaking change for users of :extension:`TypeApplications`. - In type synonyms and type family equations, free variables on the RHS are no longer implicitly quantified unless used in an outermost kind annotation: :: type T = Just (Nothing :: Maybe a) -- no longer accepted type T = Just Nothing :: Maybe (Maybe a) -- still accepted - A new extension :extension:`StandaloneKindSignatures` allows one to explicitly specify the kind of a type constructor, as proposed in `GHC proposal #54 `__: :: type TypeRep :: forall k. k -> Type data TypeRep a where TyInt :: TypeRep Int TyMaybe :: TypeRep Maybe TyApp :: TypeRep a -> TypeRep b -> TypeRep (a b) Analogous to function type signatures, a :ref:`standalone kind signature ` enables polymorphic recursion. This feature is a replacement for :extension:`CUSKs`. - GHC now parses visible, dependent quantifiers (as proposed in `GHC proposal 35 `__), such as the following: :: data Proxy :: forall k -> k -> Type See the :ref:`section on explicit kind quantification ` for more details. - Type variables in associated type family default declarations can now be explicitly bound with a ``forall`` when :extension:`ExplicitForAll` is enabled, as in the following example: :: class C a where type T a b type forall a b. T a b = Either a b This has a couple of knock-on consequences: - Wildcard patterns are now permitted on the left-hand sides of default declarations, whereas they were rejected by previous versions of GHC. - It used to be the case that default declarations supported occurrences of left-hand side arguments with higher-rank kinds, such as in the following example: :: class C a where type T a (f :: forall k. k -> Type) type T a (f :: forall k. k -> Type) = f Int This will no longer work unless ``f`` is explicitly quantified with a ``forall``, like so: :: class C a where type T a (f :: forall k. k -> Type) type forall a (f :: forall k. k -> Type). T a f = f Int - A new extension :extension:`UnliftedNewtypes` that relaxes restrictions around what kinds of types can appear inside of the data constructor for a ``newtype``. This was proposed in `GHC proposal #13 `__. - New flag :ghc-flag:`-Wderiving-defaults` that controls a warning message when both :extension:`DeriveAnyClass` and :extension:`GeneralizedNewtypeDeriving` are enabled and no explicit deriving strategy is in use. The warning is enabled by default and has been present in earlier GHC versions but without the option of disabling it. For example, this code would trigger the warning: :: class C a newtype T a = MkT a deriving C - GHC now performs more validity checks on inferred type signatures. One consequence of this change is that some programs that used to be accepted will no longer compile without enabling the required language extensions. For example, in these two modules: :: {-# LANGUAGE RankNTypes #-} module A where foo :: (forall a. a -> a) -> b -> b foo f x = f x module B where import A bar = foo Notice that ``A`` enables :ghc-flag:`RankNTypes`, but ``B`` does not. Previous versions of GHC would allow ``bar`` to typecheck, even though its inferred type is higher-rank. GHC 8.10 will now reject this, as one must now enable :ghc-flag:`RankNTypes` in ``B`` to accept the inferred type signature. Compiler ~~~~~~~~ - Add new flags :ghc-flag:`-Wunused-record-wildcards` and :ghc-flag:`-Wredundant-record-wildcards` which warn users when they have redundant or unused uses of a record wildcard match. - Calls to ``memset`` and ``memcpy`` are now unrolled more aggressively and the produced code is more efficient on `x86_64` with added support for 64-bit ``MOV``\s. In particular, ``setByteArray#`` and ``copyByteArray#`` calls that were not optimized before, now will be. See :ghc-ticket:`16052`. - GHC's runtime linker no longer uses global state. This allows programs that use the GHC API to safely use multiple GHC sessions in a single process, as long as there are no native dependencies that rely on global state. - When loading modules that use :extension:`UnboxedTuples` or :extension:`UnboxedSums` into GHCi, it will now automatically enable :ghc-flag:`-fobject-code` for these modules and all modules they depend on. Before this change, attempting to load these modules into the interpreter would just fail, and the only convenient workaround was to enable :ghc-flag:`-fobject-code` for all modules. See the :ref:`GHCi FAQ ` for further details. - The eventlog now contains events for biographical and retainer profiling. The biographical profiling events all appear at the end of the eventlog but the sample start event contains a timestamp of when the census occurred. The retainer profiling events are emitted using the standard events. - Add new flag :ghc-flag:`-fkeep-going` which makes the compiler continue as far as it can despite errors. - Deprecated flag ``-fwarn-hi-shadowing`` because it was not implemented correctly, and appears to be largely unused. This flag will be removed in a later version of GHC. GHCi ~~~~ - Added a command :ghci-cmd:`:instances` to show the class instances available for a type. - Added new debugger commands :ghci-cmd:`:disable` and :ghci-cmd:`:enable` to disable and re-enable breakpoints. Runtime system ~~~~~~~~~~~~~~ Template Haskell ~~~~~~~~~~~~~~~~ - The ``Lift`` typeclass is now levity-polymorphic and has a ``liftTyped`` method. Previously disallowed instances for unboxed tuples, unboxed sums, an primitive unboxed types have also been added. Finally, the code generated by :extension:`DeriveLift` has been simplified to take advantage of expression quotations. - Explicit boxed 1-tuples from `HsSyn` are now treated as actual 1-tuples, without flattening. In most of the cases these will be obtained using Template Haskell since it is uncommon to deal with 1-tuples in the source. - GHC's constraint solver now solves constraints in each top-level group sooner. This has practical consequences for Template Haskell, as TH splices necessarily separate top-level groups. For example, the following program would compile in previous versions of GHC, but not in GHC 8.10: :: data T = MkT tStr :: String tStr = show MkT $(return []) instance Show T where show MkT = "MkT" This is because each top-level group's constraints are solved before moving on to the next, and since the top-level group for ``tStr`` appears before the top-level group that defines a ``Show T`` instance, GHC 8.10 will throw an error about a missing ``Show T`` instance in the expression ``show MkT``. The issue can be fixed by rearranging the order of declarations. For instance, the following will compile: :: data T = MkT instance Show T where show MkT = "MkT" $(return []) tStr :: String tStr = show MkT ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ - Add new ``bitReverse#`` primops that, for a ``Word`` of 8, 16, 32 or 64 bits, reverse the order of its bits e.g. ``0b110001`` becomes ``0b100011``. These primitives use optimized machine instructions when available. ``ghc`` library ~~~~~~~~~~~~~~~ ``base`` library ~~~~~~~~~~~~~~~~ Build system ~~~~~~~~~~~~ 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. .. ghc-package-list:: libraries/array/array.cabal: Dependency of ``ghc`` library libraries/base/base.cabal: Core library libraries/binary/binary.cabal: Dependency of ``ghc`` library libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library libraries/directory/directory.cabal: Dependency of ``ghc`` library libraries/filepath/filepath.cabal: Dependency of ``ghc`` library compiler/ghc.cabal: The compiler itself libraries/ghci/ghci.cabal: The REPL interface libraries/ghc-boot/ghc-boot.cabal: Internal compiler library libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library libraries/ghc-compact/ghc-compact.cabal: Core library libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library libraries/ghc-prim/ghc-prim.cabal: Core library libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable libraries/integer-gmp/integer-gmp.cabal: Core library libraries/libiserv/libiserv.cabal: Internal compiler library libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library libraries/pretty/pretty.cabal: Dependency of ``ghc`` library libraries/process/process.cabal: Dependency of ``ghc`` library libraries/stm/stm.cabal: Dependency of ``haskeline`` library libraries/template-haskell/template-haskell.cabal: Core library libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library libraries/text/text.cabal: Dependency of ``Cabal`` library libraries/time/time.cabal: Dependency of ``ghc`` library libraries/transformers/transformers.cabal: Dependency of ``ghc`` library libraries/unix/unix.cabal: Dependency of ``ghc`` library libraries/Win32/Win32.cabal: Dependency of ``ghc`` library libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable