Commit a7ad0b91 authored by Ryan Scott's avatar Ryan Scott
Browse files

Make TypeError a newtype, add changelog entry

Summary:
Phab:D866 added the `TypeError` datatype to `Control.Exception` to represent
the error that is thrown when `-fdefer-type-errors` is on, but a changelog
entry for it was never added. In addition, it should probably be a
newtype.

Reviewers: austin, hvr, KaneTW, bgamari

Reviewed By: KaneTW, bgamari

Subscribers: thomie, KaneTW

Differential Revision: https://phabricator.haskell.org/D1873

GHC Trac Issues: #10284
parent 07ed2413
...@@ -304,6 +304,10 @@ Compiler ...@@ -304,6 +304,10 @@ Compiler
:ghc-flag:`-this-unit-id` or, if you need compatibility over multiple :ghc-flag:`-this-unit-id` or, if you need compatibility over multiple
versions of GHC, :ghc-flag:`-package-name`. versions of GHC, :ghc-flag:`-package-name`.
- When :ghc-flag:`-fdefer-type-errors` is enabled and an expression fails to
typecheck, ``Control.Exception.TypeError`` will now be thrown instead of
``Control.Exception.ErrorCall``.
GHCi GHCi
~~~~ ~~~~
...@@ -527,6 +531,10 @@ See ``changelog.md`` in the ``base`` package for full release notes. ...@@ -527,6 +531,10 @@ See ``changelog.md`` in the ``base`` package for full release notes.
- Enable ``PolyKinds`` in the ``Data.Functor.Const`` module to give ``Const`` - Enable ``PolyKinds`` in the ``Data.Functor.Const`` module to give ``Const``
the kind ``* -> k -> *`` (see :ghc-ticket:`10039`). the kind ``* -> k -> *`` (see :ghc-ticket:`10039`).
- Add the ``TypeError`` datatype to ``Control.Exception``, which represents the
error that is thrown when an expression fails to typecheck when run using
:ghc-flag:`-fdefer-type-errors`. (see :ghc-ticket:`10284`)
binary binary
~~~~~~ ~~~~~~
......
...@@ -361,7 +361,9 @@ instance Exception NoMethodError ...@@ -361,7 +361,9 @@ instance Exception NoMethodError
-- |An expression that didn't typecheck during compile time was called. -- |An expression that didn't typecheck during compile time was called.
-- This is only possible with -fdefer-type-errors. The @String@ gives -- This is only possible with -fdefer-type-errors. The @String@ gives
-- details about the failed type check. -- details about the failed type check.
data TypeError = TypeError String --
-- @since 4.9.0.0
newtype TypeError = TypeError String
instance Show TypeError where instance Show TypeError where
showsPrec _ (TypeError err) = showString err showsPrec _ (TypeError err) = showString err
......
...@@ -91,6 +91,9 @@ ...@@ -91,6 +91,9 @@
precision: `log1p`, `expm1`, `log1pexp` and `log1mexp`. These are not precision: `log1p`, `expm1`, `log1pexp` and `log1mexp`. These are not
available from `Prelude`, but the full class is exported from `Numeric`. available from `Prelude`, but the full class is exported from `Numeric`.
* New `Control.Exception.TypeError` datatype, which is thrown when an
expression fails to typecheck when run using `-fdefer-type-errors` (#10284)
### New instances ### New instances
* `Alt`, `Dual`, `First`, `Last`, `Product`, and `Sum` now have `Data`, * `Alt`, `Dual`, `First`, `Last`, `Product`, and `Sum` now have `Data`,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment