Skip to content

Commit 069e8ee

Browse files
jacgcocreature
authored andcommitted
Cleaner Show instance for SpanInfo (#244)
* Cleaner Show instance for SpanInfo This helped with debugging #237, so maybe it's worth keeping. * Stylistic fixes
1 parent cef3097 commit 069e8ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Development/IDE/Spans/Type.hs

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ module Development.IDE.Spans.Type(
1313

1414
import GHC
1515
import Control.DeepSeq
16-
import Data.Maybe
1716
import OccName
18-
17+
import Development.IDE.GHC.Util
1918

2019
-- | Type of some span of source code. Most of these fields are
2120
-- unboxed but Haddock doesn't show that.
@@ -29,15 +28,17 @@ data SpanInfo =
2928
,spaninfoEndCol :: {-# UNPACK #-} !Int
3029
-- ^ End column of the span (absolute), zero-based.
3130
,spaninfoType :: !(Maybe Type)
32-
-- ^ A pretty-printed representation fo the type.
31+
-- ^ A pretty-printed representation for the type.
3332
,spaninfoSource :: !SpanSource
3433
-- ^ The actutal 'Name' associated with the span, if
3534
-- any. This can be useful for accessing a variety of
3635
-- information about the identifier such as module,
3736
-- locality, definition location, etc.
3837
}
3938
instance Show SpanInfo where
40-
show (SpanInfo sl sc el ec t n) = show [show sl, show sc, show el, show ec, show $ isJust t, show n]
39+
show (SpanInfo sl sc el ec t n) =
40+
unwords ["(SpanInfo", show sl, show sc, show el, show ec
41+
, show $ maybe "NoType" prettyPrint t, "(" <> show n <> "))"]
4142

4243
instance NFData SpanInfo where
4344
rnf = rwhnf

0 commit comments

Comments
 (0)