[commit: ghc] ghc-8.0: Make TypeError a newtype, add changelog entry (fc5ed86)

git at git.haskell.org git at git.haskell.org
Tue Feb 2 22:56:25 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/fc5ed862ef52efa6e02e291ce441a1300ccc6e9c/ghc

>---------------------------------------------------------------

commit fc5ed862ef52efa6e02e291ce441a1300ccc6e9c
Author: RyanGlScott <ryan.gl.scott at gmail.com>
Date:   Tue Feb 2 09:03:04 2016 -0500

    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
    
    (cherry picked from commit a7ad0b91e7dace173ed95f31b221628d50c175e8)


>---------------------------------------------------------------

fc5ed862ef52efa6e02e291ce441a1300ccc6e9c
 docs/users_guide/8.0.1-notes.rst         | 8 ++++++++
 libraries/base/Control/Exception/Base.hs | 4 +++-
 libraries/base/changelog.md              | 3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst
index 8acd85a..fb293cd 100644
--- a/docs/users_guide/8.0.1-notes.rst
+++ b/docs/users_guide/8.0.1-notes.rst
@@ -296,6 +296,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
 ~~~~
 
@@ -510,6 +514,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 b609ef2..351771b 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 8560fe7..7f85f35 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`,



More information about the ghc-commits mailing list