diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-12-09 12:39:08 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-10 06:17:52 -0500 |
commit | b4a554197be38be72b4a52603efac84983a6b2bc (patch) | |
tree | 375c74d64e566e872d57e0b5dd16f15bd5aa9c27 | |
parent | 16eab39bb40bb5acacb652e71b36e627095d2147 (diff) | |
download | haskell-b4a554197be38be72b4a52603efac84983a6b2bc.tar.gz |
docs: Drop old release notes
Closes #20786
-rw-r--r-- | docs/users_guide/9.0.1-notes.rst | 504 | ||||
-rw-r--r-- | docs/users_guide/9.2.1-notes.rst | 423 | ||||
-rw-r--r-- | docs/users_guide/release-notes.rst | 2 |
3 files changed, 0 insertions, 929 deletions
diff --git a/docs/users_guide/9.0.1-notes.rst b/docs/users_guide/9.0.1-notes.rst deleted file mode 100644 index a78b8c09f8..0000000000 --- a/docs/users_guide/9.0.1-notes.rst +++ /dev/null @@ -1,504 +0,0 @@ -.. _release-9-0-1: - -Version 9.0.1 -============== - -The significant changes to the various parts of the compiler are listed in the -following sections. - -The :ghc-flag:`LLVM backend <-fllvm>` of this release is to be used with LLVM 9. - -Highlights ----------- - -* The :extension:`LinearTypes` extension enables linear function syntax - ``a %1 -> b``, as described in the `Linear Types GHC proposal - <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0111-linear-types.rst>`__. - - The GADT syntax can be used to define data types with linear and nonlinear fields. - - This extension is considered experimental: it doesn't implement the full proposal yet and the details - are subject to change. - -* NCG - - - The linear register allocator saw improvements reducing the number - of redundant move instructions. Rare edge cases can see double - digit improvements in runtime for inner loops. - - In the mean this improved runtime by about 0.8%. For details - see ticket :ghc-ticket:`17823`. - -* Pattern-Match Coverage Checking - - - The revamp of the pattern-match coverage checker that started in 8.10 concludes with this release and implements the - novel `*Lower Your Guards* <https://www.microsoft.com/en-us/research/uploads/prod/2020/03/lyg.pdf>`_ algorithm. - - Compared to 8.10, end users might notice improvements to "long-distance information": :: - - f True = 1 - f x = ... case x of { False -> 2; True -> 3 } ... - - GHC is now able to detect the case alternative returning ``3`` as redundant. - - Some more performance improvements in edge cases. - -* Windows: Use the large address-space allocator. - - This improves runtime but causes increased memory usage on Windows versions - older than Win 8.1/Server 2012. - -* Windows: New IO Manager. - - A new I/O manager (WinIO) is now available as a community technical preview which is designed to allow experimentation and - bootstrapping of third-party packages such as Network. The new I/O manager is off by default and can be enabled with the - RTS flag ``--io-manager=native``. Currently the I/O manager is *unoptimized* and is focused more on correctness. There is also - no support for pipes and sockets. These will be added in the next release. `*see more* <https://www.youtube.com/watch?v=kgNh5mdZ1xw>`__. - -* Big-number support - - - GHC now relies on a new ``ghc-bignum`` package to provide Integer/Natural - implementations. This package supports the following backends: - - - gmp: adapted from integer-gmp package that was used before - - - native: new Haskell implementation, faster than ``integer-simple`` which is - not used anymore - - - All backends now use the same representation for big numbers (the one that - was previously used only by ``integer-gmp``). It led to several compiler - simplifications, performance improvements and bug fixes (e.g. - :ghc-ticket:`15262`, :ghc-ticket:`15286`). - - - All backends must provide exactly the same set of functions with - deterministic results so that they can be tested one against the other (they - can only differ in performance). As a consequence, some functions that were - only provided by integer-gmp (prime test, secure powmod, etc.) are no longer - provided by ghc-bignum. Note that other packages (e.g. ``hgmp``) provide these - functions. - - - For now GHC still doesn't allow dynamic selection of the ``ghc-bignum`` backend - to use. - -* Breaking change: Template Haskell splices now act as separation points - between constraint solving passes. It is no longer possible to use - an instance of a class before a splice and define that instance after a splice. - For example, this code now reports a missing instance for ``C Bool``: :: - - class C a where foo :: a - bar :: Bool - bar = foo - $(return []) - instance C Bool where foo = True - - * Support for 32-bit Windows has officially been dropped as Microsoft has - formally discontinued new 32-bit Windows 10 releases in 2020. See - :ghc-ticket:`18487` for details. - - -Full details ------------- - -Language -~~~~~~~~ - -* Record field selectors are now given type signatures that preserve the - user-written order of quantified type variables. Moreover, field selector - type signatures no longer make inferred type variables available for explicit - type application. See :ref:`field-selectors-and-type-applications` for more - details. - - In certain situations, this will constitute a breaking change as this can - affect :extension:`TypeApplications`. For instance, given the following - definitions: :: - - {-# LANGUAGE PolyKinds #-} - - newtype P a = MkP { unP :: Proxy a } - - newtype N :: Type -> Type -> Type where - MkN :: forall b a. { unN :: Either a b } -> N a b - - Previous versions of GHC would give the following types to ``unP`` and - ``unN``: :: - - unP :: forall k (a :: k). P a -> Proxy a - unN :: forall a b. N a b -> Either a b - - GHC will now give them the following types instead: :: - - unP :: forall {k} (a :: k). P a -> Proxy a - unN :: forall b a. N a b -> Either a b - -* In obscure scenarios, GHC now rejects programs it previously accepted, but - with unhelpful types. For example, if (with ``-XPartialTypeSignatures``) you - were to write ``x :: forall (f :: forall a (b :: a -> Type). b _). f _``, GHC previously - would have accepted ``x``, but its type would have involved the mysterious ``Any`` - internal type family. Now, GHC rejects, explaining the situation. - -* GHC now more faithfully implements the instance-lookup scheme described with - :extension:`QuantifiedConstraints`. Previous bugs meant that programs like this - were accepted:: - - data T (c :: Type -> Constraint) - instance (forall h. c h => Functor h) => Functor (T c) - instance (forall h. c h => Applicative h) => Applicative (T c) - - Note that in the instance declaration for ``Applicative (T c)``, we cannot prove - ``Functor (T c)``, because the quantified constraint shadows the global instance. - There is an easy workaround, though: just include ``Functor (T c)`` as an assumption. :: - - instance (forall h. c h => Applicative h, Functor (T c)) => Applicative (T c) - - There is a chance we will tweak the lookup scheme in the future, to make this - workaround unnecessary. - -* GHC now consistently does eager instantiation during type inference. - As a consequence, visible type application (VTA) now only works when - the head of the application is: - - * A variable - * An expression with a type signature - - For example ``(let x = blah in id) @Bool True`` no longer typechecks. - You should write ``let x = blah in id @Bool True`` instead. - - This change prepares the way for `Quick Look impredicativity - <https://gitlab.haskell.org/ghc/ghc/issues/18126>`_. - -* GHC now implements simplified subsumption, as described in `GHC Proposal #287 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0287-simplify-subsumption.rst>`__. - This change simplifies the type system, and prevents the possibility of GHC - silently changing the semantics of user programs, but it does mean that some libraries - may need eta-expansion to typecheck. More info here: :ref:`simple-subsumption`. - - This change also prepares the way for Quick Look impredicativity. - -* GHC now allows users to manually define the specificity of type variable - binders. By marking a variable with braces ``{tyvar}`` or ``{tyvar :: kind}``, - it becomes inferred despite appearing in a type signature. This feature - effectively allows users to choose which variables can or can't be - instantiated through visible type application. More information can be found - here: :ref:`Manually-defining-inferred-variables`. - -* GADT constructor types now properly adhere to :ref:`forall-or-nothing`. As - a result, GHC will now reject some GADT constructors that previous versions - of GHC would accept, such as the following: :: - - data T where - MkT1 :: (forall a. a -> b -> T) - MkT2 :: (forall a. a -> T) - - ``MkT1`` and ``MkT2`` are rejected because the lack of an outermost - ``forall`` triggers implicit quantification, making the explicit ``forall``\ s - nested. Furthermore, GADT constructors do not permit the use of nested - ``forall``\ s, as explained in :ref:`formal-gadt-syntax`. - - In addition to rejecting nested ``forall``\ s, GHC is now more stringent about - rejecting uses of nested *contexts* in GADT constructors. For example, the - following example, which previous versions of GHC would accept, is now - rejected: :: - - data U a where - MkU :: (Show a => U a) - -* GHC more strictly enforces the rule that the type in the top of an instance - declaration is not permitted to contain nested ``forall``\ s or contexts, as - documented in :ref:`formal-instance-syntax`. For example, the following - examples, which previous versions of GHC would accept, are now rejected: :: - - instance (forall a. C a) where ... - instance (Show a => C a) where ... - - In addition, GHC now enforces the rule that the types in ``deriving`` clauses - and ``via`` types (for instances derived with :extension:`DerivingVia`) - cannot contain nested ``forall``\ s or contexts. For example, the following - examples, which previous versions of GHC would accept, are now rejected: :: - - data T = MkT deriving (C1, (forall x. C2 x)) - deriving via (forall x. V x) instance C (S x) - -* A new language extension :extension:`QualifiedDo` is implemented, allowing - to qualify a do block to control which operations to use for desugaring do - syntax. :: - - {-# LANGUAGE QualifiedDo #-} - import qualified SomeModule as M - - f x = M.do -- desugars to: - y <- M.return x -- M.return x M.>>= \y -> - M.return y -- M.return y M.>> - M.return y -- M.return y - - See :ref:`qualified-do-notation` for more details. - -* :extension:`LexicalNegation` is a new extension that detects whether the - minus sign stands for negation during lexical analysis by checking for the - surrounding whitespace: :: - - a = x - y -- subtraction - b = f -x -- negation - - f = (- x) -- operator section - c = (-x) -- negation - -* The behavior of :extension:`NegativeLiterals` changed, and now we require - that a negative literal must not be preceded by a closing token (see - `GHC Proposal #229 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst>`_) - for the definition of a closing token). In other words, we parse ``f -123`` - as ``f (-123)``, but ``x-123`` as ``(-) x 123``. Before this amendment, - :extension:`NegativeLiterals` caused ``x-123`` to be parsed as ``x(-123)``. - -* GHC is now more sensitive to whitespace between infix operators and their arguments, - requiring it in some cases where it was not previously necessary as the result of the - `whitespace-sensitive operator parsing proposal <https://github.com/ghc-proposals/ghc-proposals/pull/229>`_. - It also affects the usage of ``!``,``~`` and ``@`` as BangPatterns, irrefutable patterns - and type applications respectively. - This means that expressions that were parsed as visible type applications - in previous versions when the ``@`` was surrounded by whitespace will now - be parsed as an operator application. - For more details see the `migration guide on the wiki <https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0#whitespace-sensitive-and->`_. - -Compiler -~~~~~~~~ - -- A new flag :ghc-flag:`-flink-rts` to enable linking the RTS when linking - shared libraries. - -- The :ghc-flag:`-Wnoncanonical-monad-instances` and - :ghc-flag:`-Wnoncanonical-monoid-instances` warnings are now enabled by - default, as proposed in `GHC proposal #314 - <https://github.com/ghc-proposals/ghc-proposals/pull/314>`_ - -- The ``-funfolding-keeness-factor`` flag has been deprecated as its scaling - strategy resulted in unreasonably large discounts in some cases (see - :ghc-ticket:`15304`). Users who previously used this flag to suggest - more aggressive inlining are advised to look at - :ghc-flag:`-funfolding-use-threshold=⟨n⟩` or use :pragma:`INLINE` pragmas to - more precisely force inlining. - -GHCi -~~~~ - -- GHCi prompt no longer lists loaded modules. - The previous behavior can be restored with ``:set prompt "%s> "`` - and ``:set prompt-cont "%s| "``. - -- The ``:script`` command now allows for file names that contain spaces to - passed as arguments: either by enclosing the file names in double quotes or by - escaping spaces in file names with a backslash. (:ghc-ticket:`18027`) - -- The GHCi debugger syntax ``:break <qualified.name>`` now allows to set - breakpoints on all functions. The restrictions ``top-Level`` and ``exported`` - have been removed. Hence it's now possible to use this syntax to set - breakpoints on functions defined in nested ``where`` or ``let`` clauses. - -Runtime system -~~~~~~~~~~~~~~ - -- :rts-flag:`-N` without a count now tries to respect the number of processors - in the process's affinity mask, making GHC's behavior more predictable in - containerized settings (:ghc-ticket:`14781`). - -- Support for Windows Vista has been dropped. GHC-compiled programs now require - Windows 7 or later. - -- Windows now uses the large address space allocator by default. - In extreme cases we saw improvements by up to 3% decreased runtime. - - The downside is that haskell apps run on older (Pre Win-8.1/Server 2012) - systems will have higher memory footprints. - -Template Haskell -~~~~~~~~~~~~~~~~ - -- Implement the `Overloaded Quotations proposal (#246) <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0246-overloaded-bracket.rst>`_. - The type of all quotation forms have now been generalised in terms of a - minimal interface necessary (the ``Quote`` type class) for the - implementation rather than the overapproximation of the ``Q`` monad. - -- Template Haskell quotes now handle fixity declarations in ``let`` and - ``where`` bindings properly. Previously, such fixity declarations would - be dropped when quoted due to a Template Haskell bug. - -- The ``-XTemplateHaskellQuotes`` extension now allows nested splices as nested - splices do not lead directly to compile-time evaluation. (Merge request - `!2288 <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2288>`_) - -Arrow notation -~~~~~~~~~~~~~~ - -- When combined with :extension:`Arrows`, the :extension:`LambdaCase` extension - now additionally allows ``\case`` syntax to be used as a command in ``proc`` - notation. - -- When combined with :extension:`Arrows`, the effects of the - :extension:`BlockArguments` extension now also apply to applications of - arrow control operators in ``(|`` banana brackets ``|)``: :: - - (| untilA (increment -< x + y) do - within 0.5 -< x - ... |) - -Haddock -~~~~~~~ - -- Parsing is now more robust to insufficiently indented Haddock comments:: - - class C a where - f :: a -> a - -- ^ This comment used to trigger a parse error - g :: a -> a - -- :ghc-flag:`-Winvalid-haddock` is a new warning that reports discarded Haddock - comments that cannot be associated with AST elements:: - - myValue = - -- | Invalid (discarded) comment in an expression - 2 + 2 - -- When faced with several comments for a data constructor or a data constructor - field, Haddock now picks the first one instead of the last one. The - extraneous comment is reported as invalid when :ghc-flag:`-Winvalid-haddock` - is enabled:: - - data T - -- | First comment - = MkT - -- ^ Second comment (rejected) - - -- Haddock is now more relaxed about the placement of comments in types relative - to the function arrow ``->``, allowing more formatting styles:: - - f :: Int -> -- ^ comment on Int (no longer a parse error) - Bool -- ^ comment on Bool - -- Haddock can now parse the documentation comment for the first declaration in - a module without a module header (:ghc-ticket:`17561`):: - - -- | This comment used to trigger a parse error - main = putStrLn "Hello" - -``base`` library -~~~~~~~~~~~~~~~~ - -- ``Foreign.ForeignPtr.withForeignPtr`` is now less aggressively optimised, - avoiding the unsoundness issue reported in - :ghc-ticket:`17760` in exchange for a small amount of additional allocation. - - If your application is impacted significantly by this change and the - continuation given to ``withForeignPtr`` will not *provably* diverge (via - throwing of an exception or looping) then the previous optimisation behavior - can be recovered by instead using ``GHC.ForeignPtr.unsafeWithForeignPtr``. - - -``ghc-prim`` library -~~~~~~~~~~~~~~~~~~~~ - -- Add a known-key ``cstringLength#`` to ``GHC.CString`` that is eligible - for constant folding by a built-in rule. - -- A new primop, ``keepAlive#``, has been introduced to replace ``touch#`` in - controlling object lifetime without the soundness issues affecting the latter - (see :ghc-ticket:`17760`) - -``ghc`` library -~~~~~~~~~~~~~~~ - -- The type of the ``getAnnotations`` function has changed to better reflect - the fact that it returns two different kinds of annotations, those on - names and those on modules: :: - - getAnnotations :: Typeable a - => ([Word8] -> a) -> ModGuts - -> CoreM (ModuleEnv [a], NameEnv [a]) - -- The meaning of the ``hs_fixds`` field of ``HsGroup`` has changed slightly. - It now only contains fixity signatures defined for top-level declarations - and class methods defined *outside* of the class itself. Previously, - ``hs_fixds`` would also contain fixity signatures for class methods defined - *inside* the class, such as the fixity signature for ``m`` in the following - example: :: - - class C a where - infixl 4 `m` - m :: a -> a -> a - - If you wish to attain the previous behavior of ``hs_fixds``, use the new - ``hsGroupTopLevelFixitySigs`` function, which collects all top-level fixity - signatures, including those for class methods defined inside classes. - -- The ``Exception`` module was boiled down acknowledging the existence of - the ``exceptions`` dependency. In particular, the ``ExceptionMonad`` - class is not a proper class anymore, but a mere synonym for ``MonadThrow``, - ``MonadCatch``, ``MonadMask`` (all from ``exceptions``) and ``MonadIO``. - All of ``g*``-functions from the module (``gtry``, ``gcatch``, etc.) are - erased, and their ``exceptions``-alternatives are meant to be used in the - GHC code instead. - -- ``parseModule`` is now the only parser entry point that deals with Haddock - comments. The other entry points (``parseDeclaration``, ``parseExpression``, - etc) do not insert the Haddock comments into the AST. - -``base`` library -~~~~~~~~~~~~~~~~ - -- ``ForeignPtrContents`` has a new nullary data constructor ``FinalPtr``. - ``FinalPtr`` is intended for turning a primitive string literal into a - ``ForeignPtr``. Unlike ``PlainForeignPtr``, ``FinalPtr`` does not have - a finalizer. Replacing ``PlainForeignPtr`` that has ``NoFinalizers`` with - ``FinalPtr`` reduces allocations, reduces the size of compiled binaries, - and unlocks important Core-to-Core optimizations. ``FinalPtr`` will be used - in an upcoming ``bytestring`` release to improve the performance of - ``ByteString`` literals created with ``OverloadedStrings``. - -Build system -~~~~~~~~~~~~ - -Bootstrapping requirements --------------------------- - -- GHC now requires a C compiler which supports - ``__atomic_op_n`` builtins. This raises the requirement for GCC to 4.7. - -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/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` 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 diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst deleted file mode 100644 index fa9214aa8d..0000000000 --- a/docs/users_guide/9.2.1-notes.rst +++ /dev/null @@ -1,423 +0,0 @@ -.. _release-9-2-1: - -Version 9.2.1 -============== - -Language -~~~~~~~~ - -* :extension:`ImpredicativeTypes`: Finally, polymorphic types have become first class! - GHC 9.2 includes a full implementation of the Quick Look approach to type inference for - impredicative types, as described in in the paper - `A quick look at impredicativity - <https://www.microsoft.com/en-us/research/publication/a-quick-look-at-impredicativity/>`__ - (Serrano et al, ICFP 2020). More information here: :ref:`impredicative-polymorphism`. - This replaces the old (undefined, flaky) behaviour of the :extension:`ImpredicativeTypes` extension. - -* The first stage of the `Pointer Rep Proposal`_ has been implemented. All - boxed types, both lifted and unlifted, now have representation kinds of - the shape ``BoxedRep r``. Code that references ``LiftedRep`` and ``UnliftedRep`` - will need to be updated. - -.. _Pointer Rep Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0203-pointer-rep.rst - -* :extension:`UnliftedDatatypes`: The `Unlifted Datatypes Proposal`_ has been - implemented. That means GHC Haskell now offers a way to define algebraic - data types with strict semantics like in OCaml or Idris! The distinction to - ordinary lifted data types is made in the kind system: Unlifted data types - live in kind ``TYPE (BoxedRep Unlifted)``. :extension:`UnliftedDatatypes` - allows giving data declarations such result kinds, such as in the following - example with the help of :extension:`StandaloneKindSignatures`: :: - - type IntSet :: UnliftedType -- type UnliftedType = TYPE (BoxedRep Unlifted) - data IntSet = Branch IntSet !Int IntSet | Leaf - - See :extension:`UnliftedDatatypes` for what other declarations are - possible. Slight caveat: Most functions in ``base`` (including ``$``) - are not levity-polymorphic (yet) and hence won't work with unlifted - data types. - -.. _Unlifted Datatypes Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0265-unlifted-datatypes.rst - -* Kind inference for data/newtype instance declarations is slightly more restrictive than before. - In particular, GHC now requires that the kind of a data family instance be fully determined - by the header of the instance, without looking at the definition of the constructor. - - This means that data families that dispatched on an invisible parameter might now require this parameter - to be made explicit, as in the following example: :: - - data family DF :: forall (r :: RuntimeRep). TYPE r - newtype instance DF @IntRep = MkDF2 Int# - newtype instance DF @FloatRep = MkDF1 Float# - - See the user manual :ref:`kind-inference-data-family-instances`. - -* GHC is stricter about checking for out-of-scope type variables on the - right-hand sides of associated type family instances that are not bound on - the left-hand side. As a result, some programs that were accidentally - accepted in previous versions of GHC will now be rejected, such as this - example: :: - - class Funct f where - type Codomain f - instance Funct ('KProxy :: KProxy o) where - type Codomain 'KProxy = NatTr (Proxy :: o -> Type) - - Where: :: - - data Proxy (a :: k) = Proxy - data KProxy (t :: Type) = KProxy - data NatTr (c :: o -> Type) - - GHC will now reject the ``o`` on the right-hand side of the ``Codomain`` - instance as being out of scope, as it does not meet the requirements for - being explicitly bound (as it is not mentioned on the left-hand side) nor - implicitly bound (as it is not mentioned in an *outermost* kind signature, - as required by :ref:`scoping-class-params`). This program can be repaired in - a backwards-compatible way by mentioning ``o`` on the left-hand side: :: - - instance Funct ('KProxy :: KProxy o) where - type Codomain ('KProxy @o) = NatTr (Proxy :: o -> Type) - -- Alternatively, - -- type Codomain ('KProxy :: KProxy o) = NatTr (Proxy :: o -> Type) - -* Previously, ``-XUndecidableInstances`` accidentally implied ``-XFlexibleContexts``. - This is now fixed, but it means that some programs will newly require - ``-XFlexibleContexts``. - -* The :extension:`GHC2021` language is supported now. It builds on top of - Haskell2010, adding several stable and conservative extensions, and removing - deprecated ones. It is now also the “default” language set that is active - when no other language set, such as :extension:`Haskell98` or - :extension:`Haskell2010`, is explicitly loaded (e.g via Cabal’s - ``default-language``). - - Because :extension:`GHC2021` includes - :extension:`GeneralizedNewtypeDeriving`, which is not safe for Safe Haskell, - users of Safe Haskell are advised to use :extension:`Haskell2010` explicitly. - - The default mode of GHC until 9.0 included - :extension:`NondecreasingIndentation`, but :extension:`GHC2021` does not. - This may break code implicitly using this extension. - -* The `Record Dot Syntax Proposal`_ has been implemented: - - - A new extension :extension:`OverloadedRecordDot` provides record ``.`` syntax e.g. ``x.foo`` - - A new extension :extension:`OverloadedRecordUpdate` provides record ``.`` - syntax in record updates e.g. ``x{foo.bar = 1}``. *The design of this - extension may well change in the future.* - -.. _Record Dot Syntax Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0282-record-dot-syntax.rst - -* Various records-related extensions have been improved: - - - A new extension :extension:`NoFieldSelectors` hides record field selector - functions, so it is possible to define top-level bindings with the same names. - - - The :extension:`DisambiguateRecordFields` extension now works for updates. - An update ``expr { field = value }`` will be accepted if there is a single - field called ``field`` in scope, regardless of whether there are non-fields - in scope with the same name. - - - The :extension:`DuplicateRecordFields` extension now applies to fields in - record pattern synonyms. In particular, it is possible for a single module - to define multiple pattern synonyms using the same field names. - -* Because of simplifications to the way that GHC typechecks operator sections, - operators with nested ``forall``\ s or contexts in their type signatures might - not typecheck when used in a section. For instance, the ``g`` function below, - which was accepted in previous GHC releases, will no longer typecheck: :: - - f :: a -> forall b. b -> a - f x _ = x - - g :: a -> a - g = (`f` "hello") - - ``g`` can be made to typecheck once more by eta expanding it to - ``\x -> x `f` "hello"``. For more information, see - :ref:`simple-subsumption`. - -* :extension:`LinearTypes` can now infer multiplicity for ``case`` - expressions. Previously, the scrutinee of a ``case`` (the bit between ``case`` - and ``of``) was always assumed to have a multiplicity of ``Many``. Now, GHC - will allow the scrutinee to have a multiplicity of ``One``, using its best-effort - inference algorithm. - -* Support for matching on GADT constructors in arrow notation has been removed, - as the current implementation of :extension:`Arrows` doesn't handle GADT - evidence correctly. - - One possible workaround, for the time being, is to perform GADT matches - inside let bindings: :: - - data G a where - MkG :: Show a => a -> G a - - foo :: G a -> String - foo = proc x -> do - let res = case x of { MkG a -> show a } - returnA -< res - -Compiler -~~~~~~~~ - -- Performance of the compiler in :ghc-flag:`--make` mode with :ghc-flag:`-j[⟨n⟩]` - is significantly improved by improvements to the parallel - garbage collector noted below. - - Benchmarks show a 20% decrease in wall clock time, and a 40% decrease in cpu - time, when compiling Cabal with ``-j4`` on linux. Improvements are more dramatic - with higher parallelism, and we no longer see significant degradation in wall - clock time as parallelism increases above 4. - -- New :ghc-flag:`-Wredundant-bang-patterns` flag that enables checks for "dead" bangs. - For instance, given this program: :: - - f :: Bool -> Bool - f True = False - f !x = x - - GHC would report that the bang on ``x`` is redundant and can be removed - since the argument was already forced in the first equation. For more - details see :ghc-flag:`-Wredundant-bang-patterns`. - -- New :ghc-flag:`-Wimplicit-lift` flag which warns when a Template Haskell quote - implicitly uses ``lift``. - -- New :ghc-flag:`-finline-generics` and - :ghc-flag:`-finline-generics-aggressively` flags for improving performance of - generics-based algorithms. - - For more details see :ghc-flag:`-finline-generics` and - :ghc-flag:`-finline-generics-aggressively`. - -- GHC now supports a flag, :ghc-flag:`-fprof-callers=⟨name⟩`, for requesting - that the compiler automatically insert cost-centres on all call-sites of - the named function. - -- The heap profiler can now be controlled from within a Haskell program using - functions in ``GHC.Profiling``. Profiling can be started and stopped or a heap - census requested at a specific point in the program. - There is a new RTS flag :rts-flag:`--no-automatic-heap-samples` which can be - used to stop heap profiling starting when a program starts. - -- A new debugging facility, :ghc-flag:`-finfo-table-map`, which embeds a mapping - from the address of an info table to information about that info table, including - an approximate source position. :ghc-flag:`-fdistinct-constructor-tables` is - also useful with this flag to give each usage of a data constructor its own - unique info table so they can be distinguished in gdb and heap profiles. - -GHCi -~~~~ - -- GHCi's ``:kind!`` command now expands through type synonyms in addition to - type families. See :ghci-cmd:`:kind`. - -- GHCi's :ghci-cmd:`:edit` command now looks for an editor in - the :envvar:`VISUAL` environment variable before - :envvar:`EDITOR`, following UNIX convention. - (:ghc-ticket:`19030`) - -- GHC now follows by default the XDG Base Directory Specification. If - ``$HOME/.ghc`` is found it will fallback to the old paths to give you - time to migrate. This fallback will be removed in three releases. - -- New debugger command :ghci-cmd:`:ignore` to set an ``ignore count`` for a - specified breakpoint. The next ``ignore count`` times the program hits this - breakpoint, the breakpoint is ignored, and the program doesn't stop. - -- New optional parameter added to the command :ghci-cmd:`:continue` to set the - ``ignore count`` for the current breakpoint. - -Runtime system -~~~~~~~~~~~~~~ - -- The parallel garbage collector is now significantly more performant. Heavily - contended spinlocks have been replaced with mutexes and condition variables. - For most programs compiled with the threaded runtime, and run with more than - four capabilities, we expect minor GC pauses and GC cpu time both to be reduced. - - For very short running programs (in the order of 10s of milliseconds), we have seen - some performance regressions. We recommend programs affected by this to either - compile with the single threaded runtime, or otherwise to disable the parallel - garbage collector with :rts-flag:`-qg ⟨gen⟩`. - - We don't expect any other performance regressions, however only limited - benchmarking has been done. We have only benchmarked GHC and nofib and only on - linux. - - Users are advised to reconsider the rts flags that programs are run with. If - you have been mitigating poor parallel GC performance by: using large - nurseries (:rts-flag:`-A <-A ⟨size⟩>`), disabling load balancing (:rts-flag:`-qb ⟨gen⟩`), or - limiting parallel GC to older generations (:rts-flag:`-qg ⟨gen⟩`); then you may - find these mitigations are no longer necessary. - -- The heap profiler now has proper treatment of pinned ``ByteArray#``\ s. Such - heap objects will now be correctly attributed to their appropriate cost - centre instead of merely being lumped into the ``PINNED`` category. - Moreover, we now correctly account for the size of the array, meaning that - space lost to fragmentation is no longer counted as live data. - -- The ``-xt`` RTS flag has been removed. Now STACK and TSO closures are always - included in heap profiles. Tooling can choose to filter out these closure types - if necessary. - -- A new heap profiling mode, :rts-flag:`-hi`, profile by info table allows for - fine-grain banding by the info table address of a closure. The profiling - mode is intended to be used with :ghc-flag:`-finfo-table-map` and can best - be consumed with ``eventlog2html``. This profiling mode does not require a - profiling build. - -- The RTS will now gradually return unused memory back to the OS rather than - retaining a large amount (up to 4 * live) indefinitely. The rate at which memory - is returned is controlled by the :rts-flag:`-Fd ⟨factor⟩`. Memory return - is triggered by consecutive idle collections. - -- The default nursery size, :rts-flag:`-A <-A ⟨size⟩>`, has been increased from - 1mb to 4mb. - -Template Haskell -~~~~~~~~~~~~~~~~ - -- There are two new functions ``putDoc`` and ``getDoc``, which allow Haddock - documentation to be attached and read from module headers, declarations, - function arguments, class instances and family instances. - These functions are quite low level, so the ``withDecDoc`` function provides - a more ergonomic interface for this. Similarly ``funD_doc``, ``dataD_doc`` - and friends provide an easy way to document functions and constructors - alongside their arguments simultaneously. :: - - $(withDecsDoc "This does good things" [d| foo x = 42 |]) - -``ghc-prim`` library -~~~~~~~~~~~~~~~~~~~~ - -- ``Void#`` is now a type synonym for the unboxed tuple ``(# #)``. - Code using ``Void#`` now has to enable :extension:`UnboxedTuples`. - -Eventlog -~~~~~~~~ - -- Two new events, :event-type:`BLOCKS_SIZE` tells you about the total size of - all allocated blocks and :event-type:`MEM_RETURN` gives statistics about why - the OS is returning and retaining megablocks. - -``ghc`` library -~~~~~~~~~~~~~~~ - -- There is a significant refactoring in the solver; any type-checker plugins - will have to be updated, as GHC no longer uses flattening skolems or - flattening metavariables. - -- Type checker plugins which work with the natural numbers now - should use ``naturalTy`` kind instead of ``typeNatKind``, which has been removed. - -- The ``con_args`` field of ``ConDeclGADT`` has been renamed to ``con_g_args``. - This is because the type of ``con_g_args`` is now different from the type of - the ``con_args`` field in ``ConDeclH98``: :: - - data ConDecl pass - = ConDeclGADT - { ... - , con_g_args :: HsConDeclGADTDetails pass -- ^ Arguments; never infix - , ... - } - - | ConDeclH98 - { ... - , con_args :: HsConDeclH98Details pass -- ^ Arguments; can be infix - , ... - } - - Where: :: - - -- Introduced in GHC 9.2; was called `HsConDeclDetails` in previous versions of GHC - type HsConDeclH98Details pass - = HsConDetails (HsScaled pass (LBangType pass)) (XRec pass [LConDeclField pass]) - - -- Introduced in GHC 9.2 - data HsConDeclGADTDetails pass - = PrefixConGADT [HsScaled pass (LBangType pass)] - | RecConGADT (XRec pass [LConDeclField pass]) - - Unlike Haskell98-style constructors, GADT constructors cannot be declared - using infix syntax, which is why ``HsConDeclGADTDetails`` lacks an - ``InfixConGADT`` constructor. - - As a result of all this, the ``con_args`` field is now partial, so using - ``con_args`` as a top-level field selector is discouraged. - -``base`` library -~~~~~~~~~~~~~~~~ - -- Character set metadata bumped to Unicode 13.0.0. - -- It's possible now to promote the ``Natural`` type: :: - - data Coordinate = Mk2D Natural Natural - type MyCoordinate = Mk2D 1 10 - - The separate kind ``Nat`` is removed and now it is just a type synonym for - ``Natural``. As a consequence, one must enable ``TypeSynonymInstances`` - in order to define instances for ``Nat``. - - The ``Numeric`` module receives ``showBin`` and ``readBin`` to show and - read integer numbers in binary. - -- ``Char`` gets type-level support by analogy with strings and natural numbers. - We extend the ``GHC.TypeLits`` module with these built-in type-families: :: - - type family CmpChar (a :: Char) (b :: Char) :: Ordering - type family ConsSymbol (a :: Char) (b :: Symbol) :: Symbol - type family UnconsSymbol (a :: Symbol) :: Maybe (Char, Symbol) - type family CharToNat (c :: Char) :: Natural - type family NatToChar (n :: Natural) :: Char - - and with the type class ``KnownChar`` (and such additional functions as ``charVal`` and ``charVal'``): :: - - class KnownChar (n :: Char) - - charVal :: forall n proxy. KnownChar n => proxy n -> Char - charVal' :: forall n. KnownChar n => Proxy# n -> Char - -- A new kind-polymorphic ``Compare`` type family was added in ``Data.Type.Ord`` - and has type instances for ``Nat``, ``Symbol``, and ``Char``. Furthermore, - the ``(<=?)`` type (and ``(<=)``) from ``GHC.TypeNats`` is now governed by - this type family (as well as new comparison type operators that are exported - by ``Data.Type.Ord``). This has two important repercussions. First, GHC can - no longer deduce that all natural numbers are greater than or equal to zero. - For instance, :: - - test1 :: Proxy (0 <=? x) -> Proxy True - test1 = id - - which previously type checked will now result in a type error. Second, when - these comparison type operators are used very generically, a kind may need to - be provided. For example, :: - - test2 :: Proxy (x <=? x) -> Proxy True - test2 = id - - will now generate a type error because GHC does not know the kind of ``x``. - To fix this, one must provide an explicit kind, perhaps by changing the type - to: :: - - test2 :: forall (x :: Nat). Proxy (x <=? x) -> Proxy True - -- On POSIX, ``System.IO.openFile`` can no longer leak a file descriptor if it - is interrupted by an asynchronous exception (:ghc-ticket:`19114`, :ghc-ticket:`19115`). - -- There's a new binding ``GHC.Exts.considerAccessible``. It's equivalent to - ``True`` and allows the programmer to turn off pattern-match redundancy - warnings for particular clauses, like the third one here :: - - g :: Bool -> Int - g x = case (x, x) of - (True, True) -> 1 - (False, False) -> 2 - (True, False) | considerAccessible -> 3 -- No warning! - -- A new ``GHC.TypeError`` module is created which exposes functionality related - to custom type errors. ``TypeError`` is re-exported from ``GHC.TypeLits`` for - backwards compatibility. diff --git a/docs/users_guide/release-notes.rst b/docs/users_guide/release-notes.rst index 8b1313d8fe..a9cb88d078 100644 --- a/docs/users_guide/release-notes.rst +++ b/docs/users_guide/release-notes.rst @@ -4,6 +4,4 @@ Release notes .. toctree:: :maxdepth: 1 - 9.0.1-notes - 9.2.1-notes 9.4.1-notes |