go-ify foldr2

This helps with the changes in #7994, but might also generally be a good
idea (ignore the runtime):

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
           fft2          -0.1%     -1.5%      0.07      0.07     +0.0%
       fibheaps          +0.0%    -17.2%      0.03      0.03     +0.0%
          fluid          +0.5%     -0.7%      0.01      0.01     +0.0%
      integrate          +0.0%     -0.9%      0.16      0.16     +0.0%
        rewrite          +0.0%     -1.1%      0.02      0.02     +0.0%
--------------------------------------------------------------------------------
            Min          -0.1%    -17.2%     -1.6%     +0.0%     +0.0%
            Max          +0.5%     +0.0%   +107.7%   +106.2%    +11.3%
 Geometric Mean          +0.0%     -0.2%    +23.7%    +23.9%     +0.1%
Add newline before two `/Since: 4.7.0.0/` occurences

See also `/Since: .../` convention described in
6368362f4486226dee9d54665b4fdffde24e56f1

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Add Hackage-supported `changelog.md` file

The contents has been ripped from the release notes. I've used markdown
as this may allow for automatic conversion to docbook XML in the future,
should we choose to maintain the `base` changelog in a more human-friendly
markup format and closer to the `base`-source tree.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Add `/Since: 4.7.0.0/` to `MkFixed` constructor

As it's been exposed only since
05c03d850a7da7bd708e9a9da7de2b9ba36b6041

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Update `changelog.md` to contain more changes

Some important changes might still be missing from the changelog.

Also, `base.cabal` is updated to include `changelog.md` in the
`cabal sdist` tarball.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Add changelog entry for new `FiniteBits` class

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Improve Haddock markup in `Control.Concurrent.MVar`

This adds a labeled hyperlink to the Concurrent Haskell paper, and
replaces the itemized-list headings with proper section
headings (available since Haddock-2.14).

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Improve Haddock markup

This fixes the markup at the top of `Control.Arrow`, and improves the
markup inside DEPRECATED strings.

(Haddock supports markup inside DEPRECATED messages, which allows to
turn references to Haskell entities into hyperlinks by using the usual
Haddock markup.)

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Derive `FiniteBits` for integral newtype wrappers

When `FiniteBits` was introduced in cddc9024e67a6d4c01bb190839d0134af8c907e0
only the standard Haskell 2010 finite-size integral types were given a
`FiniteBits` instance, however, since also a DEPRECATION warning was put
in place (as per 701d9ed4b2bec5922709a91bfb625881d7dd47f0) for `bitSize`
which might point people to to `FiniteBits`, it seems sensible to derive
`FiniteBits` for all integral newtype wrappers as well.

N.B.: This makes `Integer` the only type in `base` with a `Bits`
      instance but no `FiniteBits` instance.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Show docs for coerce and Coercible in GHC.Exts

as that is the canonical place for people to import them from.
Fix a popular typo
Add release note about new `SomeAsyncException`

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Implement foldl with foldr

together with the call arity analysis and the following patch (about inlining
maximum), we get nice benefits from fusing foldl and foldl' with good
producers:

                Min          -0.1%    -74.5%     -6.8%     -8.3%    -50.0%
                Max          +0.2%      0.0%    +38.5%    +38.5%      0.0%
     Geometric Mean          -0.0%     -4.1%     +7.7%     +7.7%     -0.8%

Because this depends on a compiler optimisation, we have to watch out for cases
where this is not an improvements, and whether they occur in the wild.
Inline maximum/minium a bit more aggresively

in order to allow fusion of the foldr in the foldl in the foldl' therein.
Improve list fusion for [n::Integer..m]

enumFromTo for Integers goes via enumDeltaToInteger, which is less
efficient, as the "delta > = 0" check prevents more inlining which is
required for good fusion code. This rule avoids tihs check for the
common case of "delta = 1", makes up_fb visible and hence inlineable,
which greatly improves "length [n:Integer..m]"; even more so with
CallArity enabled. (#8766)
Test case for #8374
Wrong bug number

the previous commit added a testcase for #8766, not #8374 -- too many
tabs open.
Expand comment for enumDeltaToInteger1
Use new bitwise Int# primops in Data.Bits (re #8791)

The new primops (see also #7689) allow to optimize
`instance Bits Int` by allowing to operate directly on Int#
instead of having to convert to Word# and back to Int# again.

Authored-by: Chris Dueck <crdueck@uwaterloo.ca>
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Minor typo in comment