Commit 38af3d1d authored by Eric Seidel's avatar Eric Seidel Committed by Ben Gamari
Browse files

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
parent 8aa9f35e
......@@ -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
--------------------------------------------------------------
......
......@@ -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
......@@ -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
......@@ -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]
......
......@@ -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 _
......
......@@ -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’:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment