Add `withMVarMasked` (re #8818)

Like `withMVar`, but the @IO@ action in the second argument is executed
with asynchronous exceptions masked. This completes the `MVar` API,
which already contained `modifyMVarMasked` and `modifyMVarMasked_`.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Provide Typeable1..7 as type synonyms (see #8813)
Language extension wibble (see #8813)
Tweak Haddock markup in Data.Typeable

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Add new Data.Bits.Bits(zeroBits) method

This adds a new method to `Bits` which completes the Bits API
with a direct way to introduce a value with all bits cleared.

See also original proposal at

  http://permalink.gmane.org/gmane.comp.lang.haskell.libraries/21157
Create Data.Coerce (#8745)

Data.Coerce is a Trustworthy module which safely exports both
`Coercible` and `coerce` for use by users, as it can now be considered
safe under role checking.

See the ticket for details.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Add some instances for Monoid/Applicative (#8797)

As noted in the ticket, there's no particular reason why there aren't
Generic, Typeable, and Data instances for the types in the
Monoid/Applicative modules.

Furthermore, Product and Sum should also have Num instances as well as
Edward noted.

Aside from that, this patch also changes the dependency chain slightly -
it moves the Monoid Proxy instance into Data.Monoid and out of
Data.Proxy.

Why? Cycles (of course). Monoid depends on Typeable. Typeable uses
Proxy. Proxy uses Monoid. Boom. Luckily, Proxy only depends on Monoid
outside of the GHC namespace, so the fix is easy and clean.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Tweak documentation and update changelog.md

This adds release note entries to changelog and tweaks Haddock comments
with respect to the recent commits 1a9abe7a1a3c7 (re #8797) and
f932b79948f0 (re #8745)

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Tweak Haddock comments in `Data.Ord.Down` added in ebc85262c

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Workaround failed constant-folding for zeroBits

For some reason GHC fails to constant fold `zeroBits :: Int` and
`zeroBits :: Integer`; `ghc -show-iface` shows

  $fBitsInt_$czeroBits :: GHC.Types.Int
     {- Strictness: m,
        Unfolding: (GHC.Types.I# (GHC.Prim.andI# 1 (GHC.Prim.notI# 1))) -}

Otoh, constant-folding works as expected, reducing `zeroBits` to 0 constant
for the other integer-types (= {Word,Int}{8,16,32,64}` and `Word`). So this
quickfix is actually just treating the symptom rather than the cause.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Add shiftR and shiftL implementations to instance Bits Integer

Apart from simply making sense (avoid the conditional in 'shift'),
this makes left and right shifts on Integer more likely to inline
(plain 'shift' is just too large); and this in turn is important
when fixing the Integer case of #8832
Comments only, about the "RA" and "RL" nomenclature for shifts
Use not# rather than (`xor#` (-1)) for complement

I'm not sure why we weren't using not# before; maybe it wasn't
a primpop at that stage?  Strange.
Add RULE for "map coerce = map" (#8767)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Remove misleading comment

We actually can't inline at phase 0 here, because there's probably a
pretty good chance 'map' will get optimized away which will defeat the
rule.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Import Coercible from GHC.Types
Add functions for comparing type-level Nats and Symbols.
Comments only.

Fix the documentation on CmpSymbol and CmpNat; add a note on (<=?).
Mark Data.Coerce as Unsafe (#8827)

Signed-off-by: Austin Seipp <austin@well-typed.com>
add /Since/ annotation