+srcLocFile :: SrcLoc -> FastString
+srcLocFile (SrcLoc fname _ _) = fname
+srcLocFile other = FSLIT("<unknown file")
+
+srcLocLine :: SrcLoc -> Int
+srcLocLine (SrcLoc _ l c) = iBox l
+srcLocLine other = panic "srcLocLine: unknown line"
+
+srcLocCol :: SrcLoc -> Int
+srcLocCol (SrcLoc _ l c) = iBox c
+srcLocCol other = panic "srcLocCol: unknown col"
+
+advanceSrcLoc :: SrcLoc -> Char -> SrcLoc
+advanceSrcLoc (SrcLoc f l c) '\t' = SrcLoc f l (tab c)
+advanceSrcLoc (SrcLoc f l c) '\n' = SrcLoc f (l +# 1#) 0#
+advanceSrcLoc (SrcLoc f l c) _ = SrcLoc f l (c +# 1#)
+advanceSrcLoc loc _ = loc -- Better than nothing
+
+-- Advance to the next tab stop. Tabs are at column positions 0, 8, 16, etc.
+tab :: FastInt -> FastInt
+tab c = (c `quotInt#` 8# +# 1#) *# 8#