[commit: ghc] master: Add a derived `Show SrcLoc` instance (38af3d1)

git at git.haskell.org git at git.haskell.org
Sat Feb 6 13:45:53 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/38af3d1db2889423a12a2232b9d52181bba23d75/ghc

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

commit 38af3d1db2889423a12a2232b9d52181bba23d75
Author: Eric Seidel <gridaphobe at gmail.com>
Date:   Sat Feb 6 14:16:53 2016 +0100

    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


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

38af3d1db2889423a12a2232b9d52181bba23d75
 libraries/base/GHC/Show.hs                                            | 3 +++
 testsuite/tests/ghci.debugger/scripts/break006.stderr                 | 4 ++--
 testsuite/tests/ghci.debugger/scripts/print019.stderr                 | 2 +-
 .../tests/overloadedlists/should_fail/overloadedlistsfail01.stderr    | 2 +-
 testsuite/tests/typecheck/should_compile/holes2.stderr                | 2 +-
 testsuite/tests/typecheck/should_fail/tcfail133.stderr                | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libraries/base/GHC/Show.hs b/libraries/base/GHC/Show.hs
index 4322aff..a3807bb 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 3b57eb3..b04dd16 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 0dcc854..428abb1 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 7a43f4f..9a72957 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 5541689..f10ea95 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 a178f02..d8795ea 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’:



More information about the ghc-commits mailing list