[project @ 2005-04-29 23:39:12 by simonpj]
[ghc-hetmet.git] / ghc / compiler / basicTypes / SrcLoc.lhs
index 1fc1172..a8d037c 100644 (file)
@@ -23,7 +23,7 @@ module SrcLoc (
        srcLocFile,             -- return the file name part
        srcLocLine,             -- return the line part
        srcLocCol,              -- return the column part
-
+       pprDefnLoc,
 
        SrcSpan,                -- Abstract
        noSrcSpan,
@@ -304,6 +304,12 @@ combineSrcSpans    start end
        col2  = srcSpanEndCol end
        file  = srcSpanFile start
 
+pprDefnLoc :: SrcLoc -> SDoc
+-- "defined at ..." or "imported from ..."
+pprDefnLoc loc
+  | isGoodSrcLoc loc = ptext SLIT("Defined at") <+> ppr loc
+  | otherwise       = ppr loc
+
 instance Outputable SrcSpan where
     ppr span
       = getPprStyle $ \ sty ->