diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-02-02 09:03:04 -0500 |
---|---|---|
committer | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-02-02 09:03:19 -0500 |
commit | a7ad0b91e7dace173ed95f31b221628d50c175e8 (patch) | |
tree | b88d4bb479a9a35ec4d23cdc7b56a96d10408d3a | |
parent | 07ed24132ebe62aab15f14a655506decdf252ff9 (diff) | |
download | haskell-a7ad0b91e7dace173ed95f31b221628d50c175e8.tar.gz |
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
-rw-r--r-- | docs/users_guide/8.0.1-notes.rst | 8 | ||||
-rw-r--r-- | libraries/base/Control/Exception/Base.hs | 4 | ||||
-rw-r--r-- | libraries/base/changelog.md | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index cf4cf8dfae..9159026943 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -304,6 +304,10 @@ Compiler :ghc-flag:`-this-unit-id` or, if you need compatibility over multiple 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 ~~~~ @@ -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`` 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 ~~~~~~ diff --git a/libraries/base/Control/Exception/Base.hs b/libraries/base/Control/Exception/Base.hs index b609ef2095..351771bf4e 100644 --- a/libraries/base/Control/Exception/Base.hs +++ b/libraries/base/Control/Exception/Base.hs @@ -361,7 +361,9 @@ instance Exception NoMethodError -- |An expression that didn't typecheck during compile time was called. -- This is only possible with -fdefer-type-errors. The @String@ gives -- details about the failed type check. -data TypeError = TypeError String +-- +-- @since 4.9.0.0 +newtype TypeError = TypeError String instance Show TypeError where showsPrec _ (TypeError err) = showString err diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 8560fe7110..7f85f35a46 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -91,6 +91,9 @@ precision: `log1p`, `expm1`, `log1pexp` and `log1mexp`. These are not 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 * `Alt`, `Dual`, `First`, `Last`, `Product`, and `Sum` now have `Data`, |