summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Seidel <gridaphobe@gmail.com>2016-02-06 14:16:53 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-06 08:46:39 -0500
commit38af3d1db2889423a12a2232b9d52181bba23d75 (patch)
treee8ce3c739cc76a2bbd8ce4f6c9f6a43b0d3d0683
parent8aa9f35e4c5e14410bc76ab08ef73f1abe700189 (diff)
downloadhaskell-38af3d1db2889423a12a2232b9d52181bba23d75.tar.gz
Add a derived `Show SrcLoc` instance
Test Plan: ``` ghci> import GHC.Stack ghci> SrcLoc "f" "b" "c" 1 2 3 4 SrcLoc {srcLocPackage = "f", srcLocModule = "b", srcLocFile = "c", srcLocStartLine = 1, srcLocStartCol = 2, srcLocEndLine = 3, srcLocEndCol = 4} ``` Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1886 GHC Trac Issues: #11510
-rw-r--r--libraries/base/GHC/Show.hs3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stderr4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stderr2
-rw-r--r--testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/holes2.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.stderr2
6 files changed, 9 insertions, 6 deletions
diff --git a/libraries/base/GHC/Show.hs b/libraries/base/GHC/Show.hs
index 4322aff2e8..a3807bbf32 100644
--- a/libraries/base/GHC/Show.hs
+++ b/libraries/base/GHC/Show.hs
@@ -52,6 +52,7 @@ module GHC.Show
import GHC.Base
import GHC.List ((!!), foldr1, break)
import GHC.Num
+import GHC.Stack.Types
-- | The @shows@ functions return a function that prepends the
-- output 'String' to an existing 'String'. This allows constant-time
@@ -204,6 +205,8 @@ instance Show TrName where
instance Show Module where
showsPrec _ (Module p m) = shows p . (':' :) . shows m
+deriving instance Show SrcLoc
+
--------------------------------------------------------------
-- Show instances for the first few tuple
--------------------------------------------------------------
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr
index 3b57eb3a64..b04dd169a0 100644
--- a/testsuite/tests/ghci.debugger/scripts/break006.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr
@@ -10,7 +10,7 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 23 others
- ...plus 19 instance involving out-of-scope typess
+ ...plus 20 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
@@ -25,6 +25,6 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 23 others
- ...plus 19 instance involving out-of-scope typess
+ ...plus 20 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr
index 0dcc854245..428abb15fa 100644
--- a/testsuite/tests/ghci.debugger/scripts/print019.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr
@@ -9,6 +9,6 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 30 others
- ...plus 8 instance involving out-of-scope typess
+ ...plus 9 instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
index 7a43f4f778..9a72957573 100644
--- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
+++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
@@ -8,7 +8,7 @@ overloadedlistsfail01.hs:5:8: error:
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
...plus 22 others
- ...plus four instance involving out-of-scope typess
+ ...plus five instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In the expression: print [1]
In an equation for ‘main’: main = print [1]
diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr
index 5541689c83..f10ea95e61 100644
--- a/testsuite/tests/typecheck/should_compile/holes2.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes2.stderr
@@ -8,7 +8,7 @@ holes2.hs:3:5: warning:
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
...plus 22 others
- ...plus three instance involving out-of-scope typess
+ ...plus four instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In the expression: show _
In an equation for ‘f’: f = show _
diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
index a178f02801..d8795eab90 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
@@ -12,7 +12,7 @@ tcfail133.hs:68:7: error:
instance (Show a, Show b, Number a, Digit b) => Show (a :@ b)
-- Defined at tcfail133.hs:11:54
...plus 25 others
- ...plus three instance involving out-of-scope typess
+ ...plus four instance involving out-of-scope typess
(use -fprint-potential-instances to see them all)
• In the expression: show $ add (One :@ Zero) (One :@ One)
In an equation for ‘foo’: