[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / compiler / basicTypes / SrcLoc.lhs
index cfd42a6..0b2439b 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1994
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
 %************************************************************************
 %*                                                                     *
@@ -21,14 +21,16 @@ module SrcLoc (
 
        mkGeneratedSrcLoc,      -- Code generated within the compiler
 
-       incSrcLine
+       incSrcLine,
+       
+       srcLocFile              -- return the file name part.
     ) where
 
 #include "HsVersions.h"
 
 import Outputable
 import FastString      ( unpackFS )
-import GlaExts         ( Int(..), Int#, (+#) )
+import GlaExts         ( Int(..), (+#) )
 \end{code}
 
 %************************************************************************
@@ -72,6 +74,9 @@ mkGeneratedSrcLoc   = UnhelpfulSrcLoc SLIT("<compiler-generated-code>")
 isNoSrcLoc NoSrcLoc = True
 isNoSrcLoc other    = False
 
+srcLocFile :: SrcLoc -> FAST_STRING
+srcLocFile (SrcLoc fname _) = fname
+
 incSrcLine :: SrcLoc -> SrcLoc
 incSrcLine (SrcLoc s l) = SrcLoc s (l +# 1#)
 incSrcLine loc         = loc