on master help sign in
Cleaner Show instance for SpanInfo (#244)

* Cleaner Show instance for SpanInfo This helped with debugging #237, so maybe it's worth keeping. * Stylistic fixes

commit069e8ee8c747f5fb26d56e17fee57f22b4f2817e authorJacek Generowicz <jacg@my-post-office.net> dateSat 14 Dec 2019, 21:02 (7 years ago) parentcef3097
1 file changed+5−4
src/Development/IDE/Spans/Type.hs+5−4
src/Development/IDE/Spans/Type.hs+5−4
@@ -13,9 +13,8 @@ module Development.IDE.Spans.Type(
1313
1414import GHC
1515import Control.DeepSeq
16−import Data.Maybe
1716import 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,7 +28,7 @@ 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
@@ -37,7 +36,9 @@ data SpanInfo =
3736 -- locality, definition location, etc.
3837 }
3938instance 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
4243instance NFData SpanInfo where
4344 rnf = rwhnf