summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Dukhovni <ietf-dane@dukhovni.org>2021-06-22 15:29:15 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-24 12:04:54 -0400
commit138b7a5775251c330ade870a0b8d1f5c4659e669 (patch)
tree243c16f5fb8384b0f2fb4ffd3a3af4c780245b5f
parent171413c6789dea02305c34c12407b815449d69be (diff)
downloadhaskell-138b7a5775251c330ade870a0b8d1f5c4659e669.tar.gz
There's no "errorWithCallStack", just use "error".
There's no `errorWithCallStack`, only `errorWithStackTrace`, but the latter is now deprecated, since `error` now defaults to returning a stack strace. So rather than change this to the intended deprecated function we replace `errorWithCallStack` with `error` instead.
-rw-r--r--docs/users_guide/exts/callstack.rst17
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/users_guide/exts/callstack.rst b/docs/users_guide/exts/callstack.rst
index 59d17cae9c..579a003148 100644
--- a/docs/users_guide/exts/callstack.rst
+++ b/docs/users_guide/exts/callstack.rst
@@ -72,7 +72,7 @@ The ``CallStack`` will only extend as far as the types allow it, for
example ::
myHead :: HasCallStack => [a] -> a
- myHead [] = errorWithCallStack "empty"
+ myHead [] = error "empty"
myHead (x:xs) = x
bad :: Int
@@ -83,12 +83,11 @@ example ::
ghci> bad
*** Exception: empty
CallStack (from HasCallStack):
- errorWithCallStack, called at Bad.hs:8:15 in main:Bad
+ error, called at Bad.hs:8:15 in main:Bad
myHead, called at Bad.hs:12:7 in main:Bad
-includes the call-site of ``errorWithCallStack`` in ``myHead``, and of
-``myHead`` in ``bad``, but not the call-site of ``bad`` at the GHCi
-prompt.
+includes the call-site of ``error`` in ``myHead``, and of ``myHead`` in
+``bad``, but not the call-site of ``bad`` at the GHCi prompt.
GHC solves ``HasCallStack`` constraints in two steps:
@@ -114,12 +113,12 @@ package, module, and file name, as well as the line and column numbers.
allows users to freeze the current ``CallStack``, preventing any future push
operations from having an effect. This can be used by library authors
to prevent ``CallStack``\s from exposing unnecessary implementation
-details. Consider the ``myHead`` example above, the ``errorWithCallStack`` line in
-the printed stack is not particularly enlightening, so we might choose
-to suppress it by freezing the ``CallStack`` that we pass to ``errorWithCallStack``. ::
+details. Consider the ``myHead`` example above, the ``error`` line in the
+printed stack is not particularly enlightening, so we might choose to suppress
+it by freezing the ``CallStack`` that we pass to ``error``. ::
myHead :: HasCallStack => [a] -> a
- myHead [] = withFrozenCallStack (errorWithCallStack "empty")
+ myHead [] = withFrozenCallStack (error "empty")
myHead (x:xs) = x
.. code-block:: none