diff options
author | Maciej Bielecki <zyla@prati.pl> | 2016-12-14 16:43:25 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-12-15 10:42:25 -0500 |
commit | 0c3341b23e0672fb9c05d9f6ab0be76f411d526e (patch) | |
tree | cc8fe826571b77b5d95665058b0a294caa27142f /docs | |
parent | 52c5e55348170f27f5ef1cb010c4c96ab4aa47cc (diff) | |
download | haskell-0c3341b23e0672fb9c05d9f6ab0be76f411d526e.tar.gz |
Show constraints when reporting typed holes
This patch implements the display of constraints in the error message
for typed holes.
Test Plan: validate, read docs
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D2767
GHC Trac Issues: #10614
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/glasgow_exts.rst | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 912f9aef2f..5db8bdc13b 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9696,6 +9696,33 @@ Here are some more details: implementation terms, they are reported by the renamer rather than the type checker.) +There's a flag for controlling the amount of context information shown for +typed holes: + +.. ghc-flag:: -fshow-hole-constraints + + When reporting typed holes, also print constraints that are in scope. + Example: :: + + f :: Eq a => a -> Bool + f x = _ + + results in the following message: + + .. code-block:: none + + show_constraints.hs:4:7: error: + • Found hole: _ :: Bool + • In the expression: _ + In an equation for ‘f’: f x = _ + • Relevant bindings include + x :: a (bound at show_constraints.hs:4:3) + f :: a -> Bool (bound at show_constraints.hs:4:1) + Constraints include + Eq a (from the type signature for: + f :: Eq a => a -> Bool + at show_constraints.hs:3:1-22) + .. _partial-type-signatures: |