changelog.md 36.8 KB
Newer Older
1
2
# Changelog for [`base` package](http://hackage.haskell.org/package/base)

3
4
5
## 4.17.0.0 *TBA*

  * Add explicitly bidirectional `pattern TypeRep` to `Type.Reflection`.
6

7
8
9
10
  * Add `Generically` and `Generically1` to `GHC.Generics` for deriving generic
    instances with `DerivingVia`. `Generically` instances include `Semigroup` and
    `Monoid`. `Generically1` instances: `Functor`, `Applicative`, `Alternative`,
    `Eq1` and `Ord1`.
11

12
13
14
  * Introduce `GHC.ExecutablePath.executablePath`, which is more robust than
    `getExecutablePath` in cases when the executable has been deleted.

15
  * Add `Data.Array.Byte` module, providing a boxed `ByteArray#`.
16

17
18
19
  * `fromEnum` for `Natural` now throws an error for any number that cannot be
    repesented exactly by an `Int` (#20291).

Oleg Grenrus's avatar
Oleg Grenrus committed
20
21
  * `returnA` is defined as `Control.Category.id` instead of `arr id`.

22
23
24
25
26
27
28
29
  * Added symbolic synonyms for `xor` and shift operators to `Data.Bits`:

    - `.^.` (`xor`),
    - `.>>.` and `!>>.` (`shiftR` and `unsafeShiftR`),
    - `.<<.` and `!<<.` (`shiftL` and `unsafeShiftL`).

    These new operators have the same fixity as the originals.

sheaf's avatar
sheaf committed
30
31
  * `GHC.Exts` now re-exports `Multiplicity` and `MultMul`.

32
33
34
35
  * A large number of partial functions in `Data.List` and `Data.List.NonEmpty` now
    have an HasCallStack constraint. Hopefully providing better error messages in case
    they are used in unexpected ways.

36
37
  * Fix the `Ord1` instance for `Data.Ord.Down` to reverse sort order.

Cheng Shao's avatar
Cheng Shao committed
38
39
40
41
  * Any Haskell type that wraps a C pointer type has been changed from
    `Ptr ()` to `CUIntPtr`. For typical glibc based platforms, the
    affected type is `CTimer`.

42
43
44
## 4.16.0.0 *Nov 2021*

  * The unary tuple type, `Solo`, is now exported by `Data.Tuple`.
45

46
47
  * Add a `Typeable` constraint to `fromStaticPtr` in the class `GHC.StaticPtr.IsStatic`.

48
49
50
51
52
53
  * Make it possible to promote `Natural`s and remove the separate `Nat` kind.
    For backwards compatibility, `Nat` is now a type synonym for `Natural`.
    As a consequence, one must enable `TypeSynonymInstances`
    in order to define instances for `Nat`. Also, different instances for `Nat` and `Natural`
    won't typecheck anymore.

54
55
56
57
58
59
60
61
  * Add `Data.Type.Ord` as a module for type-level comparison operations.  The
    `(<=?)` type operator from `GHC.TypeNats`, previously kind-specific to
    `Nat`, is now kind-polymorphic and governed by the `Compare` type family in
    `Data.Type.Ord`.  Note that this means GHC will no longer deduce `0 <= n`
    for all `n` any more.

  * Add `cmpNat`, `cmpSymbol`, and `cmpChar` to `GHC.TypeNats` and `GHC.TypeLits`.

62
63
64
65
66
  * Add `CmpChar`, `ConsSymbol`, `UnconsSymbol`, `CharToNat`, and `NatToChar`
    type families to `GHC.TypeLits`.

  * Add the `KnownChar` class, `charVal` and `charVal'` to `GHC.TypeLits`.

67
68
69
  * Add `Semigroup` and `Monoid` instances for `Data.Functor.Product` and
    `Data.Functor.Compose`.

Ben Gamari's avatar
Ben Gamari committed
70
71
72
73
  * Add `Functor`, `Applicative`, `Monad`, `MonadFix`, `Foldable`, `Traversable`,
    `Eq`, `Ord`, `Show`, `Read`, `Eq1`, `Ord1`, `Show1`, `Read1`, `Generic`,
    `Generic1`, and `Data` instances for `GHC.Tuple.Solo`.

74
  * Add `Eq1`, `Read1` and `Show1` instances for `Complex`;
75
    add `Eq1/2`, `Ord1/2`, `Show1/2` and `Read1/2` instances for 3 and 4-tuples.
76

Simon Jakobi's avatar
Simon Jakobi committed
77
78
  * Remove `Data.Semigroup.Option` and the accompanying `option` function.

79
80
81
82
83
  * Make `allocaBytesAligned` and `alloca` throw an IOError when the
    alignment is not a power-of-two. The underlying primop
    `newAlignedPinnedByteArray#` actually always assumed this but we didn't
    document this fact in the user facing API until now.

David Feuer's avatar
David Feuer committed
84
85
86
87
88
    `Generic1`, and `Data` instances for `GHC.Tuple.Solo`.

  * Under POSIX, `System.IO.openFile` will no longer leak a file descriptor if it
    is interrupted by an asynchronous exception (#19114, #19115).

89
90
  * Additionally export `asum` from `Control.Applicative`

91
92
93
  * `fromInteger :: Integer -> Float/Double` now consistently round to the
    nearest value, with ties to even.

94
95
96
97
98
99
100
  * Add `GHC.TypeError` module to contain functionality related to custom type
    errors. `TypeError` is re-exported from `GHC.TypeLits` for backwards
    compatibility.

  * Comparison constraints in `Data.Type.Ord` (e.g. `<=`) now use the new
    `GHC.TypeError.Assert` type family instead of type equality with `~`.

101
102
103
104
105
106
107
108
  * Additions to `Data.Bits`:

    - Newtypes `And`, `Ior`, `Xor` and `Iff` which wrap their argument,
      and whose `Semigroup` instances are defined using `(.&.)`, `(.|.)`, `xor`
      and ```\x y -> complement (x `xor` y)```, respectively.

    - `oneBits :: FiniteBits a => a`, `oneBits = complement zeroBits`.

109
## 4.15.0.0 *TBA*
110
111
112
113

  * `openFile` now calls the `open` system call with an `interruptible` FFI
    call, ensuring that the call can be interrupted with `SIGINT` on POSIX
    systems.
114

115
116
117
  * Make `openFile` more tolerant of asynchronous exceptions: more care taken
    to release the file descriptor and the read/write lock (#18832)

118
119
120
  * Add `hGetContents'`, `getContents'`, and `readFile'` in `System.IO`:
    Strict IO variants of `hGetContents`, `getContents`, and `readFile`.

121
122
  * Add `singleton` function for `Data.List.NonEmpty`.

123
124
125
  * The planned deprecation of `Data.Monoid.First` and `Data.Monoid.Last`
    is scrapped due to difficulties with the suggested migration path.

Simon Jakobi's avatar
Simon Jakobi committed
126
127
128
  * `Data.Semigroup.Option` and the accompanying `option` function are
    deprecated and scheduled for removal in 4.16.

129
130
131
132
  * Add `Generic` instances to `Fingerprint`, `GiveGCStats`, `GCFlags`,
    `ConcFlags`, `DebugFlags`, `CCFlags`, `DoHeapProfile`, `ProfFlags`,
    `DoTrace`, `TraceFlags`, `TickyFlags`, `ParFlags`, `RTSFlags`, `RTSStats`,
    `GCStats`, `ByteOrder`, `GeneralCategory`, `SrcLoc`
133

Andreas Klebinger's avatar
Andreas Klebinger committed
134
135
136
137
138
139
  * Add rules `unpackUtf8`, `unpack-listUtf8` and `unpack-appendUtf8` to `GHC.Base`.
    They correspond to their ascii versions and hopefully make it easier
    for libraries to handle utf8 encoded strings efficiently.

  * An issue with list fusion and `elem` was fixed. `elem` applied to known
    small lists will now compile to a simple case statement more often.
140
141

  * Add `MonadFix` and `MonadZip` instances for `Complex`
142
143

  * Add `Ix` instances for tuples of size 6 through 15
144

Ben Gamari's avatar
Ben Gamari committed
145
146
  * Correct `Bounded` instance and remove `Enum` and `Integral` instances for
    `Data.Ord.Down`.
147
148
149

  * `catMaybes` is now implemented using `mapMaybe`, so that it is both a "good
    consumer" and "good producer" for list-fusion (#18574)
150

Ben Gamari's avatar
Ben Gamari committed
151
152
153
154
155
156
157
158
  * `Foreign.ForeignPtr.withForeignPtr` is now less aggressively optimised,
    avoiding the soundness issue reported in
    [#17760](https://gitlab.haskell.org/ghc/ghc/-/issues/17760) in exchange for
    a small amount more allocation. If your application regresses significantly
    *and* the continuation given to `withForeignPtr` will *not* provably
    diverge then the previous optimisation behavior can be recovered by instead
    using `GHC.ForeignPtr.unsafeWithForeignPtr`.

159
160
161
  * Correct `Bounded` instance and remove `Enum` and `Integral` instances for
    `Data.Ord.Down`.

162
163
164
  * `Data.Foldable` methods `maximum{,By}`, `minimum{,By}`, `product` and `sum`
    are now stricter by default, as well as in the class implementation for List.

Ben Gamari's avatar
Ben Gamari committed
165
## 4.14.0.0 *Jan 2020*
Ben Gamari's avatar
Ben Gamari committed
166
  * Bundled with GHC 8.10.1
167
168
169

  * Add a `TestEquality` instance for the `Compose` newtype.

170
171
  * `Data.Ord.Down` now has a field name, `getDown`

172
173
174
175
  * Add `Bits`, `Bounded`, `Enum`, `FiniteBits`, `Floating`, `Fractional`,
    `Integral`, `Ix`, `Real`, `RealFrac`, `RealFloat` and `Storable` instances
    to `Data.Ord.Down`.

176
177
178
179
  * Fix the `integer-gmp` variant of `isValidNatural`: Previously it would fail
    to detect values `<= maxBound::Word` that were incorrectly encoded using
    the `NatJ#` constructor.

180
181
182
183
184
185
  * The type of `coerce` has been generalized. It is now runtime-representation
    polymorphic:
    `forall {r :: RuntimeRep} (a :: TYPE r) (b :: TYPE r). Coercible a b => a -> b`.
    The type argument `r` is marked as `Inferred` to prevent it from
    interfering with visible type application.

186
187
188
189
  * Make `Fixed` and `HasResolution` poly-kinded.

  * Add `HasResolution` instances for `Nat`s.

190
191
192
  * Add `Functor`, `Applicative`, `Monad`, `Alternative`, `MonadPlus`,
    `Generic` and `Generic1` instances to `Kleisli`

193
194
  * `openTempFile` is now fully atomic and thread-safe on Windows.

195
196
197
  * Add `isResourceVanishedError`, `resourceVanishedErrorType`, and
    `isResourceVanishedErrorType` to `System.IO.Error`.

198
199
200
  * Add newtypes for `CSocklen` (`socklen_t`) and `CNfds` (`nfds_t`) to
    `System.Posix.Types`.

201
  * Add `Functor`, `Applicative` and `Monad` instances to `(,,) a b`
202
203
204
    and `(,,,) a b c`.

  * Add `resizeSmallMutableArray#` to `GHC.Exts`.
205

206
207
  * Add a `Data` instance to `WrappedArrow`, `WrappedMonad`, and `ZipList`.

208
209
  * Add `IsList` instance for `ZipList`.

Ben Gamari's avatar
Ben Gamari committed
210
211
## 4.13.0.0 *July 2019*
  * Bundled with GHC 8.8.1
212

213
214
215
216
217
218
219
220
  * The final phase of the `MonadFail` proposal has been implemented:

    * The `fail` method of `Monad` has been removed in favor of the method of
      the same name in the `MonadFail` class.

    * `MonadFail(fail)` is now re-exported from the `Prelude` and
      `Control.Monad` modules.

221
222
223
224
225
  * Fix `Show` instance of `Data.Fixed`: Negative numbers are now parenthesized
    according to their surrounding context. I.e. `Data.Fixed.show` produces
    syntactically correct Haskell for expressions like `Just (-1 :: Fixed E2)`.
    (#16031)

226
227
228
  * Support the characters from recent versions of Unicode (up to v. 12) in
    literals (#5518).

David Feuer's avatar
David Feuer committed
229
230
231
232
  * The `StableName` type parameter now has a phantom role instead of
    a representational one. There is really no reason to care about the
    type of the underlying object.

233
234
  * Add `foldMap'`, a strict version of `foldMap`, to `Foldable`.

235
236
237
238
  * The `shiftL` and `shiftR` methods in the `Bits` instances of `Int`, `IntN`,
    `Word`, and `WordN` now throw an overflow exception for negative shift
    values (instead of being undefined behaviour).

239
  * `scanr` no longer crashes when passed a fusable, infinite list. (#16943)
240

Ben Gamari's avatar
Ben Gamari committed
241
242
## 4.12.0.0 *21 September 2018*
  * Bundled with GHC 8.6.1
243

244
245
246
247
248
249
250
251
252
253
254
  * The STM invariant-checking mechanism (`always` and `alwaysSucceeds`), which
    was deprecated in GHC 8.4, has been removed (as proposed in
    <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0011-deprecate-stm-invariants.rst>).
    This is a bit earlier than proposed in the deprecation pragma included in
    GHC 8.4, but due to community feedback we decided to move ahead with the
    early removal.

    Existing users are encouraged to encapsulate their STM operations in safe
    abstractions which can perform the invariant checking without help from the
    runtime system.

255
256
257
  * Add a new module `GHC.ResponseFile` (previously defined in the `haddock`
    package). (#13896)

258
259
  * Move the module `Data.Functor.Contravariant` from the
    `contravariant` package to `base`.
260
261
262

  * `($!)` is now representation-polymorphic like `($)`.

263
264
265
  * Add `Applicative` (for `K1`), `Semigroup` and `Monoid` instances in
    `GHC.Generics`. (#14849)

David Feuer's avatar
David Feuer committed
266
267
  * `asinh` for `Float` and `Double` is now numerically stable in the face of
    non-small negative arguments and enormous arguments of either sign. (#14927)
268

269
270
  * `Numeric.showEFloat (Just 0)` now respects the user's requested precision.
    (#15115)
chessai's avatar
chessai committed
271

272
  * `Data.Monoid.Alt` now has `Foldable` and `Traversable` instances. (#15099)
273

chessai's avatar
chessai committed
274
275
  * `Data.Monoid.Ap` has been introduced

276
277
  * `Control.Exception.throw` is now levity polymorphic. (#15180)

278
279
280
281
282
  * `Data.Ord.Down` now has a number of new instances. These include:
    `MonadFix`, `MonadZip`, `Data`, `Foldable`, `Traversable`, `Eq1`, `Ord1`,
    `Read1`, `Show1`, `Generic`, `Generic1`. (#15098)


Ben Gamari's avatar
Ben Gamari committed
283
## 4.11.1.0 *19 April 2018*
284
285
  * Bundled with GHC 8.4.2

286
287
288
  * Add the `readFieldHash` function to `GHC.Read` which behaves like
    `readField`, but for a field that ends with a `#` symbol (#14918).

Ben Gamari's avatar
Ben Gamari committed
289
## 4.11.0.0 *8 March 2018*
290
  * Bundled with GHC 8.4.1
291

292
293
  * `System.IO.openTempFile` is now thread-safe on Windows.

294
295
  * Deprecated `GHC.Stats.GCStats` interface has been removed.

296
297
  * Add `showHFloat` to `Numeric`

298
  * Add `Div`, `Mod`, and `Log2` functions on type-level naturals
299
300
    in `GHC.TypeLits`.

301
302
  * Add `Alternative` instance for `ZipList` (#13520)

ase's avatar
ase committed
303
304
305
  * Add instances `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup`
    and `Monoid` for `Data.Ord.Down` (#13097).

306
307
308
  * Add `Semigroup` instance for `EventLifetime`.

  * Make `Semigroup` a superclass of `Monoid`;
309
    export `Semigroup((<>))` from `Prelude`; remove `Monoid` reexport
310
311
    from `Data.Semigroup` (#14191).

312
313
314
  * Generalise `instance Monoid a => Monoid (Maybe a)` to
    `instance Semigroup a => Monoid (Maybe a)`.

315
  * Add `infixl 9 !!` declaration for `Data.List.NonEmpty.!!`
ase's avatar
ase committed
316

317
318
  * Add `<&>` operator to `Data.Functor` (#14029)

319
320
  * Remove the deprecated `Typeable{1..7}` type synonyms (#14047)

David Feuer's avatar
David Feuer committed
321
322
323
324
325
326
327
328
  * Make `Data.Type.Equality.==` a closed type family. It now works for all
  kinds out of the box. Any modules that previously declared instances of this
  family will need to remove them. Whereas the previous definition was somewhat
  ad hoc, the behavior is now completely uniform. As a result, some applications
  that used to reduce no longer do, and conversely. Most notably, `(==)` no
  longer treats the `*`, `j -> k`, or `()` kinds specially; equality is
  tested structurally in all cases.

329
330
  * Add instances `Semigroup` and `Monoid` for `Control.Monad.ST` (#14107).

331
332
333
334
335
  * The `Read` instances for `Proxy`, `Coercion`, `(:~:)`, `(:~~:)`, and `U1`
    now ignore the parsing precedence. The effect of this is that `read` will
    be able to successfully parse more strings containing `"Proxy"` _et al._
    without surrounding parentheses (e.g., `"Thing Proxy"`) (#12874).

Ben Gamari's avatar
Ben Gamari committed
336
337
338
  * Add `iterate'`, a strict version of `iterate`, to `Data.List`
    and `Data.OldList` (#3474)

339
340
  * Add `Data` instances for `IntPtr` and `WordPtr` (#13115)

341
342
  * Add missing `MonadFail` instance for `Control.Monad.Strict.ST.ST`

Tao He's avatar
Tao He committed
343
344
  * Make `zipWith` and `zipWith3` inlinable (#14224)

345
346
  * `Type.Reflection.App` now matches on function types (fixes #14236)

347
348
349
  * `Type.Reflection.withTypeable` is now polymorphic in the `RuntimeRep` of
    its result.

350
351
  * Add `installSEHHandlers` to `MiscFlags` in `GHC.RTS.Flags` to determine if
    exception handling is enabled.
352

353
354
  * The deprecated functions `isEmptyChan` and `unGetChan` in
    `Control.Concurrent.Chan` have been removed (#13561).
355

356
357
358
  * Add `generateCrashDumpFile` to `MiscFlags` in `GHC.RTS.Flags` to determine
    if a core dump will be generated on crashes.

359
360
361
  * Add `generateStackTrace` to `MiscFlags` in `GHC.RTS.Flags` to determine if
    stack traces will be generated on unhandled exceptions by the RTS.

362
363
  * `getExecutablePath` now resolves symlinks on Windows (#14483)

364
365
366
  * Deprecated STM invariant checking primitives (`checkInv`, `always`, and
    `alwaysSucceeds`) in `GHC.Conc.Sync` (#14324).

367
368
369
370
  * Add a `FixIOException` data type to `Control.Exception.Base`, and change
    `fixIO` to throw that instead of a `BlockedIndefinitelyOnMVar` exception
    (#14356).

371
372
373
374
375
376
377
378
## 4.10.1.0 *November 2017*
  * Bundled with GHC 8.2.2

  * The file locking primitives provided by `GHC.IO.Handle` now use
    Linux open file descriptor locking if available.

  * Fixed bottoming definition of `clearBit` for `Natural`

379
380
## 4.10.0.0 *July 2017*
  * Bundled with GHC 8.2.1
381

382
383
  * `Data.Type.Bool.Not` given a type family dependency (#12057).

384
385
386
  * `Foreign.Ptr` now exports the constructors for `IntPtr` and `WordPtr`
    (#11983)

Ryan Scott's avatar
Ryan Scott committed
387
388
389
  * `Generic1`, as well as the associated datatypes and typeclasses in
    `GHC.Generics`, are now poly-kinded (#10604)

390
391
392
  * `New modules `Data.Bifoldable` and `Data.Bitraversable` (previously defined
    in the `bifunctors` package) (#10448)

393
394
  * `Data.Either` now provides `fromLeft` and `fromRight` (#12402)

395
396
  * `Data.Type.Coercion` now provides `gcoerceWith` (#12493)

397
398
399
400
401
  * New methods `liftReadList(2)` and `liftReadListPrec(2)` in the
    `Read1`/`Read2` classes that are defined in terms of `ReadPrec` instead of
    `ReadS`, as well as related combinators, have been added to
    `Data.Functor.Classes` (#12358)

402
403
404
  * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime`
    from `GHC.Event` (#12464)

Ryan Scott's avatar
Ryan Scott committed
405
406
  * Add `Data` instance for `Const` (#12438)

407
408
  * Added `Eq1`, `Ord1`, `Read1` and `Show1` instances for `NonEmpty`.

409
  * Add wrappers for `blksize_t`, `blkcnt_t`, `clockid_t`, `fsblkcnt_t`,
410
    `fsfilcnt_t`, `id_t`, `key_t`, and `timer_t` to System.Posix.Types (#12795)
411

Ryan Scott's avatar
Ryan Scott committed
412
413
414
  * Add `CBool`, a wrapper around C's `bool` type, to `Foreign.C.Types`
    (#13136)

415
416
  * Raw buffer operations in `GHC.IO.FD` are now strict in the buffer, offset, and length operations (#9696)

417
418
  * Add `plusForeignPtr` to `Foreign.ForeignPtr`.

419
420
421
  * Add `type family AppendSymbol (m :: Symbol) (n :: Symbol) :: Symbol` to `GHC.TypeLits`
    (#12162)

422
423
424
425
  * Add `GHC.TypeNats` module with `Natural`-based `KnownNat`. The `Nat`
    operations in `GHC.TypeLits` are a thin compatibility layer on top.
    Note: the `KnownNat` evidence is changed from an `Integer` to a `Natural`.

426
427
  * The type of `asProxyTypeOf` in `Data.Proxy` has been generalized (#12805)

David Feuer's avatar
David Feuer committed
428
429
430
431
432
433
434
  * `liftA2` is now a method of the `Applicative` class. `liftA2` and
    `<*>` each have a default implementation based on the other. Various
    library functions have been updated to use `liftA2` where it might offer
    some benefit. `liftA2` is not yet in the `Prelude`, and must currently be
    imported from `Control.Applicative`. It is likely to be added to the
    `Prelude` in the future. (#13191)

435
436
  * A new module, `Type.Reflection`, exposing GHC's new type-indexed type
    representation mechanism is now provided.
Ben Gamari's avatar
Ben Gamari committed
437
438
439
440

  * `Data.Dynamic` now exports the `Dyn` data constructor, enabled by the new
    type-indexed type representation mechanism.

441
442
  * `Data.Type.Equality` now provides a kind heterogeneous type equality
    evidence type, `(:~~:)`.
Ben Gamari's avatar
Ben Gamari committed
443

Ben Gamari's avatar
Ben Gamari committed
444
445
446
447
  * The `CostCentresXML` constructor of `GHC.RTS.Flags.DoCostCentres` has been
    replaced by `CostCentresJSON` due to the new JSON export format supported by
    the cost centre profiler.

448
449
450
451
  * The `ErrorCall` pattern synonym has been given a `COMPLETE` pragma so that
    functions which solely match again `ErrorCall` do not produce
    non-exhaustive pattern-match warnings (#8779)

452
  * Change the implementations of `maximumBy` and `minimumBy` from
Gabor Greif's avatar
Gabor Greif committed
453
    `Data.Foldable` to use `foldl1` instead of `foldr1`. This makes them run
454
455
    in constant space when applied to lists. (#10830)

456
  * `mkFunTy`, `mkAppTy`, and `mkTyConApp` from `Data.Typeable` no longer exist.
Ben Gamari's avatar
Ben Gamari committed
457
    This functionality is superceded by the interfaces provided by
Ryan Scott's avatar
Ryan Scott committed
458
    `Type.Reflection`.
459
460
461
462

  * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is
    replaced by `Type.Reflection.Unsafe.mkTyCon`.

Ben Gamari's avatar
Ben Gamari committed
463
464
465
  * `Data.List.NonEmpty.unfold` has been deprecated in favor of `unfoldr`,
    which is functionally equivalent.

466
## 4.9.0.0  *May 2016*
467
468

  * Bundled with GHC 8.0
Austin Seipp's avatar
Austin Seipp committed
469

Eric Seidel's avatar
Eric Seidel committed
470
471
472
473
  * `error` and `undefined` now print a partial stack-trace alongside the error message.

  * New `errorWithoutStackTrace` function throws an error without printing the stack trace.

474
475
476
  * The restore operation provided by `mask` and `uninterruptibleMask` now
    restores the previous masking state whatever the current masking state is.

477
478
  * New `GHC.Generics.packageName` operation

479
480
481
  * Redesigned `GHC.Stack.CallStack` data type. As a result, `CallStack`'s
    `Show` instance produces different output, and `CallStack` no longer has an
    `Eq` instance.
482

Eric Seidel's avatar
Eric Seidel committed
483
484
485
486
487
488
489
490
491
492
493
  * New `GHC.Generics.packageName` operation

  * New `GHC.Stack.Types` module now contains the definition of
    `CallStack` and `SrcLoc`

  * New `GHC.Stack.Types.emptyCallStack` function builds an empty `CallStack`

  * New `GHC.Stack.Types.freezeCallStack` function freezes a `CallStack` preventing future `pushCallStack` operations from having any effect

  * New `GHC.Stack.Types.pushCallStack` function pushes a call-site onto a `CallStack`

494
495
496
  * New `GHC.Stack.Types.fromCallSiteList` function creates a `CallStack` from
    a list of call-sites (i.e., `[(String, SrcLoc)]`)

Eric Seidel's avatar
Eric Seidel committed
497
498
499
500
501
  * `GHC.SrcLoc` has been removed

  * `GHC.Stack.showCallStack` and `GHC.SrcLoc.showSrcLoc` are now called
    `GHC.Stack.prettyCallStack` and `GHC.Stack.prettySrcLoc` respectively

Ben Gamari's avatar
Ben Gamari committed
502
503
504
  * add `Data.List.NonEmpty` and `Data.Semigroup` (to become
    super-class of `Monoid` in the future). These modules were
    provided by the `semigroups` package previously. (#10365)
505

Ben Gamari's avatar
Ben Gamari committed
506
507
508
509
  * Add `selSourceUnpackedness`, `selSourceStrictness`, and
    `selDecidedStrictness`, three functions which look up strictness
    information of a field in a data constructor, to the `Selector` type class
    in `GHC.Generics` (#10716)
510

Ben Gamari's avatar
Ben Gamari committed
511
512
513
  * Add `URec`, `UAddr`, `UChar`, `UDouble`, `UFloat`, `UInt`, and `UWord` to
    `GHC.Generics` as part of making GHC generics capable of handling
    unlifted types (#10868)
514

515
516
517
  * The `Eq`, `Ord`, `Read`, and `Show` instances for `U1` now use lazier
    pattern-matching

Ben Gamari's avatar
Ben Gamari committed
518
519
  * Keep `shift{L,R}` on `Integer` with negative shift-arguments from
    segfaulting (#10571)
Gabriella439's avatar
Gabriella439 committed
520

Ben Gamari's avatar
Ben Gamari committed
521
522
  * Add `forkOSWithUnmask` to `Control.Concurrent`, which is like
    `forkIOWithUnmask`, but the child is run in a bound thread.
523

Ben Gamari's avatar
Ben Gamari committed
524
  * The `MINIMAL` definition of `Arrow` is now `arr AND (first OR (***))`.
525

Ben Gamari's avatar
Ben Gamari committed
526
  * The `MINIMAL` definition of `ArrowChoice` is now `left OR (+++)`.
527

528
529
530
  * Exported `GiveGCStats`, `DoCostCentres`, `DoHeapProfile`, `DoTrace`,
    `RtsTime`, and `RtsNat` from `GHC.RTS.Flags`

531
532
533
  * New function `GHC.IO.interruptible` used to correctly implement
    `Control.Exception.allowInterrupt` (#9516)

534
535
536
  * Made `PatternMatchFail`, `RecSelError`, `RecConError`, `RecUpdError`,
    `NoMethodError`, and `AssertionFailed` newtypes (#10738)

537
538
539
  * New module `Control.Monad.IO.Class` (previously provided by `transformers`
    package). (#10773)

540
541
542
543
  * New modules `Data.Functor.Classes`, `Data.Functor.Compose`,
    `Data.Functor.Product`, and `Data.Functor.Sum` (previously provided by
    `transformers` package). (#11135)

544
545
546
  * New instances for `Proxy`: `Eq1`, `Ord1`, `Show1`, `Read1`. All
    of the classes are from `Data.Functor.Classes` (#11756).

547
548
549
  * New module `Control.Monad.Fail` providing new `MonadFail(fail)`
    class (#10751)

Ben Gamari's avatar
Ben Gamari committed
550
551
  * Add `GHC.TypeLits.TypeError` and `ErrorMessage` to allow users
    to define custom compile-time error messages.
552

Ben Gamari's avatar
Ben Gamari committed
553
554
  * Redesign `GHC.Generics` to use type-level literals to represent the
    metadata of generic representation types (#9766)
555

Ben Gamari's avatar
Ben Gamari committed
556
557
  * The `IsString` instance for `[Char]` has been modified to eliminate
    ambiguity arising from overloaded strings and functions like `(++)`.
558

Ben Gamari's avatar
Ben Gamari committed
559
560
  * Move `Const` from `Control.Applicative` to its own module in
   `Data.Functor.Const`. (#11135)
561

Ben Gamari's avatar
Ben Gamari committed
562
  * Re-export `Const` from `Control.Applicative` for backwards compatibility.
joeyadams's avatar
joeyadams committed
563

Ben Gamari's avatar
Ben Gamari committed
564
565
566
  * Expand `Floating` class to include operations that allow for better
    precision: `log1p`, `expm1`, `log1pexp` and `log1mexp`. These are not
    available from `Prelude`, but the full class is exported from `Numeric`.
joeyadams's avatar
joeyadams committed
567

568
569
570
  * New `Control.Exception.TypeError` datatype, which is thrown when an
    expression fails to typecheck when run using `-fdefer-type-errors` (#10284)

571
572
573
  * The `bitSize` method of `Data.Bits.Bits` now has a (partial!)
    default implementation based on `bitSizeMaybe`. (#12970)

Ben Gamari's avatar
Ben Gamari committed
574
### New instances
575

Ben Gamari's avatar
Ben Gamari committed
576
577
578
  * `Alt`, `Dual`, `First`, `Last`, `Product`, and `Sum` now have `Data`,
    `MonadZip`, and `MonadFix` instances

579
580
581
582
583
  * The datatypes in `GHC.Generics` now have `Enum`, `Bounded`, `Ix`,
    `Functor`, `Applicative`, `Monad`, `MonadFix`, `MonadPlus`, `MonadZip`,
    `Foldable`, `Foldable`, `Traversable`, `Generic1`, and `Data` instances
    as appropriate.

Ben Gamari's avatar
Ben Gamari committed
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
  * `Maybe` now has a `MonadZip` instance

  * `All` and `Any` now have `Data` instances

  * `Dual`, `First`, `Last`, `Product`, and `Sum` now have `Foldable` and
    `Traversable` instances

  * `Dual`, `Product`, and `Sum` now have `Functor`, `Applicative`, and
    `Monad` instances

  * `(,) a` now has a `Monad` instance

  * `ZipList` now has `Foldable` and `Traversable` instances

  * `Identity` now has `Semigroup` and `Monoid` instances

600
601
602
  * `Identity` and `Const` now have `Bits`, `Bounded`, `Enum`, `FiniteBits`,
    `Floating`, `Fractional`, `Integral`, `IsString`, `Ix`, `Num`, `Real`,
    `RealFloat`, `RealFrac` and `Storable` instances. (#11210, #11790)
Ben Gamari's avatar
Ben Gamari committed
603
604
605
606
607
608
609
610
611
612
613

  * `()` now has a `Storable` instance

  * `Complex` now has `Generic`, `Generic1`, `Functor`, `Foldable`, `Traversable`,
    `Applicative`, and `Monad` instances

  * `System.Exit.ExitCode` now has a `Generic` instance

  * `Data.Version.Version` now has a `Generic` instance

  * `IO` now has a `Monoid` instance
614

615
616
617
  * Add `MonadPlus IO` and `Alternative IO` instances
    (previously orphans in `transformers`) (#10755)

618
619
  * `CallStack` now has an `IsList` instance

620
621
622
  * The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed.
    The value is no longer available when constructing the `StaticPtr`.

623
624
  * `VecElem` and `VecCount` now have `Enum` and `Bounded` instances.

Ben Gamari's avatar
Ben Gamari committed
625
### Generalizations
Ben Gamari's avatar
Ben Gamari committed
626

Ben Gamari's avatar
Ben Gamari committed
627
628
  * Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative`
    (#10023)
629

Eric Seidel's avatar
Eric Seidel committed
630
631
632
633
  * Redundant typeclass constraints have been removed:
     - `Data.Ratio.{denominator,numerator}` have no `Integral` constraint anymore
     - **TODO**

Ben Gamari's avatar
Ben Gamari committed
634
  * Generalise `forever` from `Monad` to `Applicative`
635

Ben Gamari's avatar
Ben Gamari committed
636
637
638
639
  * Generalize `filterM`, `mapAndUnzipM`, `zipWithM`, `zipWithM_`, `replicateM`,
    `replicateM_` from `Monad` to `Applicative` (#10168)

  * The `Generic` instance for `Proxy` is now poly-kinded (#10775)
640
641
642
643
644

  * Enable `PolyKinds` in the `Data.Functor.Const` module to give `Const`
    the kind `* -> k -> *`. (#10039)


645
646
647
648
649
650
651
652
653
654
## 4.8.2.0  *Oct 2015*

  * Bundled with GHC 7.10.3

  * The restore operation provided by `mask` and `uninterruptibleMask` now
    restores the previous masking state whatever the current masking state is.

  * Exported `GiveGCStats`, `DoCostCentres`, `DoHeapProfile`, `DoTrace`,
    `RtsTime`, and `RtsNat` from `GHC.RTS.Flags`

655
## 4.8.1.0  *Jul 2015*
656
657
658

  * Bundled with GHC 7.10.2

659
660
  * `Lifetime` is now exported from `GHC.Event`

661
  * Implicit-parameter based source location support exposed in `GHC.SrcLoc` and `GHC.Stack`.
662
663
    See GHC User's Manual for more information.

664
## 4.8.0.0  *Mar 2015*
665
666
667

  * Bundled with GHC 7.10.1

668
669
  * Make `Applicative` a superclass of `Monad`

670
671
  * Add reverse application operator `Data.Function.(&)`

672
673
  * Add `Data.List.sortOn` sorting function

Simon Hengel's avatar
Simon Hengel committed
674
675
  * Add `System.Exit.die`

676
677
678
679
680
681
  * Deprecate `versionTags` field of `Data.Version.Version`.
    Add `makeVersion :: [Int] -> Version` constructor function to aid
    migration to a future `versionTags`-less `Version`.

  * Add `IsList Version` instance

682
683
  * Weaken RealFloat constraints on some `Data.Complex` functions

684
685
  * Add `Control.Monad.(<$!>)` as a strict version of `(<$>)`

686
687
688
689
  * The `Data.Monoid` module now has the `PolyKinds` extension
    enabled, so that the `Monoid` instance for `Proxy` are polykinded
    like `Proxy` itself is.

690
  * Make `abs` and `signum` handle (-0.0) correctly per IEEE-754.
691

692
693
  * Re-export `Data.Word.Word` from `Prelude`

694
695
696
  * Add `countLeadingZeros` and `countTrailingZeros` methods to
    `Data.Bits.FiniteBits` class

697
698
  * Add `Data.List.uncons` list destructor (#9550)

699
700
701
702
703
704
705
  * Export `Monoid(..)` from `Prelude`

  * Export `Foldable(..)` from `Prelude`
    (hiding `fold`, `foldl'`, `foldr'`, and `toList`)

  * Export `Traversable(..)` from `Prelude`

706
707
708
  * Set fixity for `Data.Foldable.{elem,notElem}` to match the
    conventional one set for `Data.List.{elem,notElem}` (#9610)

709
710
711
  * Turn `toList`, `elem`, `sum`, `product`, `maximum`, and `minimum`
    into `Foldable` methods (#9621)

712
713
714
  * Replace the `Data.List`-exported functions

    ```
715
716
    all, and, any, concat, concatMap, elem, find, product, sum,
    mapAccumL, mapAccumR
717
718
    ```

719
720
721
722
    by re-exports of their generalised `Data.Foldable`/`Data.Traversable`
    counterparts.  In other words, unqualified imports of `Data.List`
    and `Data.Foldable`/`Data.Traversable` no longer lead to conflicting
    definitions. (#9586)
723

724
725
726
727
  * New (unofficial) module `GHC.OldList` containing only list-specialised
    versions of the functions from `Data.List` (in other words, `GHC.OldList`
    corresponds to `base-4.7.0.2`'s `Data.List`)

728
729
730
  * Replace the `Control.Monad`-exported functions

    ```
731
732
    sequence_, msum, mapM_, forM_,
    forM, mapM, sequence
733
734
    ```

735
736
737
738
    by re-exports of their generalised `Data.Foldable`/`Data.Traversable`
    counterparts.  In other words, unqualified imports of `Control.Monad`
    and `Data.Foldable`/`Data.Traversable` no longer lead to conflicting
    definitions. (#9586)
739

740
741
742
  * Generalise `Control.Monad.{when,unless,guard}` from `Monad` to
    `Applicative` and from `MonadPlus` to `Alternative` respectively.

743
744
  * Generalise `Control.Monad.{foldM,foldM_}` to `Foldable`

David Feuer's avatar
David Feuer committed
745
746
  * `scanr`, `mapAccumL` and `filterM` now take part in list fusion (#9355,
    #9502, #9546)
747

748
749
  * Remove deprecated `Data.OldTypeable` (#9639)

750
751
752
  * New module `Data.Bifunctor` providing the `Bifunctor(bimap,first,second)`
    class (previously defined in `bifunctors` package) (#9682)

753
754
755
  * New module `Data.Void` providing the canonical uninhabited type `Void`
    (previously defined in `void` package) (#9814)

756
757
  * Update Unicode class definitions to Unicode version 7.0

758
759
  * Add `Alt`, an `Alternative` wrapper, to `Data.Monoid`. (#9759)

760
761
  * Add `isSubsequenceOf` to `Data.List` (#9767)

762
763
764
765
  * The arguments to `==` and `eq` in `Data.List.nub` and `Data.List.nubBy`
    are swapped, such that `Data.List.nubBy (<) [1,2]` now returns `[1]`
    instead of `[1,2]` (#2528, #3280, #7913)

766
767
768
  * New module `Data.Functor.Identity` (previously provided by `transformers`
    package). (#9664)

769
770
771
  * Add `scanl'`, a strictly accumulating version of `scanl`, to `Data.List`
    and `Data.OldList`. (#9368)

772
773
  * Add `fillBytes` to `Foreign.Marshal.Utils`.

774
775
  * Add new `displayException` method to `Exception` typeclass. (#9822)

776
777
778
  * Add `Data.Bits.toIntegralSized`, a size-checked version of
    `fromIntegral`. (#9816)

779
780
781
782
  * New module `Numeric.Natural` providing new `Natural` type
    representing non-negative arbitrary-precision integers.  The `GHC.Natural`
    module exposes additional GHC-specific primitives. (#9818)

783
784
785
786
  * Add `(Storable a, Integeral a) => Storable (Ratio a)` instance (#9826)

  * Add `Storable a => Storable (Complex a)` instance (#9826)

787
788
  * New module `GHC.RTS.Flags` that provides accessors to runtime flags.

789
790
791
792
793
794
795
796
797
  * Expose functions for per-thread allocation counters and limits in `GHC.Conc`

        disableAllocationLimit :: IO ()
        enableAllocationLimit :: IO ()
        getAllocationCounter :: IO Int64
        setAllocationCounter :: Int64 -> IO ()

    together with a new exception `AllocationLimitExceeded`.

798
799
  * Make `read . show = id` for `Data.Fixed` (#9240)

800
  * Add `calloc` and `callocBytes` to `Foreign.Marshal.Alloc`. (#9859)
801

802
  * Add `callocArray` and `callocArray0` to `Foreign.Marshal.Array`. (#9859)
803

804
805
  * Restore invariant in `Data (Ratio a)` instance (#10011)

806
807
  * Add/expose `rnfTypeRep`, `rnfTyCon`, `typeRepFingerprint`, and
    `tyConFingerprint` helpers to `Data.Typeable`.
808

809
810
  * Define proper `MINIMAL` pragma for `class Ix`. (#10142)

811
812
813
814
815
816
817
818
## 4.7.0.2  *Dec 2014*

  * Bundled with GHC 7.8.4

  * Fix performance bug in `Data.List.inits` (#9345)

  * Fix handling of null bytes in `Debug.Trace.trace` (#9395)

819
820
821
822
823
824
825
826
827
828
829
830
831
## 4.7.0.1  *Jul 2014*

  * Bundled with GHC 7.8.3

  * Unhide `Foreign.ForeignPtr` in Haddock (#8475)

  * Fix recomputation of `TypeRep` in `Typeable` type-application instance
    (#9203)

  * Fix regression in Data.Fixed Read instance (#9231)

  * Fix `fdReady` to honor `FD_SETSIZE` (#9168)

832
## 4.7.0.0  *Apr 2014*
833
834
835

  * Bundled with GHC 7.8.1

836
837
838
839
  * Add `/Since: 4.[4567].0.0/` Haddock annotations to entities
    denoting the package version, when the given entity was introduced
    (or its type signature changed in a non-compatible way)

840
841
842
843
844
845
846
  * The `Control.Category` module now has the `PolyKinds` extension
    enabled, meaning that instances of `Category` no longer need be of
    kind `* -> * -> *`.

  * There are now `Foldable` and `Traversable` instances for `Either a`,
   `Const r`, and `(,) a`.

847
848
  * There are now `Show`, `Read`, `Eq`, `Ord`, `Monoid`, `Generic`, and
    `Generic1` instances for `Const`.
849
850
851

  * There is now a `Data` instance for `Data.Version`.

852
853
854
855
856
  * A new `Data.Bits.FiniteBits` class has been added to represent
    types with fixed bit-count. The existing `Bits` class is extended
    with a `bitSizeMaybe` method to replace the now obsolete
    `bitsize` method.

857
858
859
  * `Data.Bits.Bits` gained a new `zeroBits` method which completes the
    `Bits` API with a direct way to introduce a value with all bits cleared.

860
861
  * There are now `Bits` and `FiniteBits` instances for `Bool`.

862
863
  * There are now `Eq`, `Ord`, `Show`, `Read`, `Generic`. and `Generic1`
    instances for `ZipList`.
864
865
866
867
868
869
870

  * There are now `Eq`, `Ord`, `Show` and `Read` instances for `Down`.

  * There are now `Eq`, `Ord`, `Show`, `Read` and `Generic` instances
    for types in GHC.Generics (`U1`, `Par1`, `Rec1`, `K1`, `M1`,
    `(:+:)`, `(:*:)`, `(:.:)`).

871
872
873
874
875
876
  * `Data.Monoid`: There are now `Generic` instances for `Dual`, `Endo`,
    `All`, `Any`, `Sum`, `Product`, `First`, and `Last`; as well as
    `Generic1` instances for `Dual`, `Sum`, `Product`, `First`, and `Last`.

  * The `Data.Monoid.{Product,Sum}` newtype wrappers now have `Num` instances.

877
878
879
  * There are now `Functor` instances for `System.Console.GetOpt`'s
    `ArgOrder`, `OptDescr`, and `ArgDescr`.

880
881
882
883
884
  * A zero-width unboxed poly-kinded `Proxy#` was added to
    `GHC.Prim`. It can be used to make it so that there is no the
    operational overhead for passing around proxy arguments to model
    type application.

885
886
  * New `Data.Proxy` module providing a concrete, poly-kinded proxy type.

887
888
889
890
  * New `Data.Coerce` module which exports the new `Coercible` class
    together with the `coerce` primitive which provide safe coercion
    (wrt role checking) between types with same representation.

891
892
893
894
895
896
897
  * `Control.Concurrent.MVar` has a new implementation of `readMVar`,
    which fixes a long-standing bug where `readMVar` is only atomic if
    there are no other threads running `putMVar`.  `readMVar` now is
    atomic, and is guaranteed to return the value from the first
    `putMVar`.  There is also a new `tryReadMVar` which is a
    non-blocking version.

898
899
900
901
  * New `Control.Concurrent.MVar.withMVarMasked` which executes
    `IO` action with asynchronous exceptions masked in the same style
    as the existing `modifyMVarMasked` and `modifyMVarMasked_`.

902
903
904
905
906
907
908
909
910
  * New `threadWait{Read,Write}STM :: Fd -> IO (STM (), IO ())`
    functions added to `Control.Concurrent` for waiting on FD
    readiness with STM actions.

  * Expose `Data.Fixed.Fixed`'s constructor.

  * There are now byte endian-swapping primitives
    `byteSwap{16,32,64}` available in `Data.Word`, which use
    optimized machine instructions when available.
911
912
913
914

  * `Data.Bool` now exports `bool :: a -> a -> Bool -> a`, analogously
    to `maybe` and `either` in their respective modules.

915
916
917
918
919
920
921
  * `Data.Either` now exports `isLeft, isRight :: Either a b -> Bool`.

  * `Debug.Trace` now exports `traceId`, `traceShowId`, `traceM`,
    and `traceShowM`.

  * `Data.Functor` now exports `($>)` and `void`.

922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
  * Rewrote portions of `Text.Printf`, and made changes to `Numeric`
    (added `Numeric.showFFloatAlt` and `Numeric.showGFloatAlt`) and
    `GHC.Float` (added `formatRealFloatAlt`) to support it.  The
    rewritten version is extensible to user types, adds a "generic"
    format specifier "`%v`", extends the `printf` spec to support much
    of C's `printf(3)` functionality, and fixes the spurious warnings
    about using `Text.Printf.printf` at `(IO a)` while ignoring the
    return value.  These changes were contributed by Bart Massey.

  * The minimal complete definitions for all type-classes with cyclic
    default implementations have been explicitly annotated with the
    new `{-# MINIMAL #-}` pragma.

  * `Control.Applicative.WrappedMonad`, which can be used to convert a
    `Monad` to an `Applicative`, has now a
    `Monad m => Monad (WrappedMonad m)` instance.
938

939
940
941
  * There is now a `Generic` and a `Generic1` instance for `WrappedMonad`
    and `WrappedArrow`.

942
943
944
945
946
947
948
949
950
951
952
  * Handle `ExitFailure (-sig)` on Unix by killing process with signal `sig`.

  * New module `Data.Type.Bool` providing operations on type-level booleans.

  * Expose `System.Mem.performMinorGC` for triggering minor GCs.

  * New `System.Environment.{set,unset}Env` for manipulating
    environment variables.

  * Add `Typeable` instance for `(->)` and `RealWorld`.

953
  * Declare CPP header `<Typeable.h>` officially obsolete as GHC 7.8+
954
955
956
957
958
959
960
961
962
    does not support hand-written `Typeable` instances anymore.

  * Remove (unmaintained) Hugs98 and NHC98 specific code.

  * Optimize `System.Timeout.timeout` for the threaded RTS.

  * Remove deprecated functions `unsafeInterleaveST`, `unsafeIOToST`,
    and `unsafeSTToIO` from `Control.Monad.ST`.

963
964
965
966
  * Add a new superclass `SomeAsyncException` for all asynchronous exceptions
    and makes the existing `AsyncException` and `Timeout` exception children
    of `SomeAsyncException` in the hierarchy.

967
968
969
970
971
972
973
974
975
  * Remove deprecated functions `blocked`, `unblock`, and `block` from
    `Control.Exception`.

  * Remove deprecated function `forkIOUnmasked` from `Control.Concurrent`.

  * Remove deprecated function `unsafePerformIO` export from `Foreign`
    (still available via `System.IO.Unsafe.unsafePerformIO`).

  * Various fixes and other improvements (see Git history for full details).