Skip to content

Commit

Permalink
Cleaner Show instance for SpanInfo (#244)
Browse files Browse the repository at this point in the history
* Cleaner Show instance for SpanInfo

This helped with debugging #237, so maybe it's worth keeping.

* Stylistic fixes
  • Loading branch information
jacg authored and cocreature committed Dec 14, 2019
1 parent cef3097 commit 069e8ee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Development/IDE/Spans/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ module Development.IDE.Spans.Type(

import GHC
import Control.DeepSeq
import Data.Maybe
import OccName

import Development.IDE.GHC.Util

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

instance NFData SpanInfo where
rnf = rwhnf
Expand Down

0 comments on commit 069e8ee

Please sign in to comment.