SrcLoc

Plain source file: base/AST/SrcLoc.hs (2004-01-17)

SrcLoc is imported by: BaseSyntax, HsDeclStruct, HsDeclUtil, HsExpStruct, HsExpUtil, HsGuardsPretty, HsGuardsStruct, HsGuardsUtil, HsIdent, HsModule, HsPatStruct, SrcLocPretty, TiContextReduction, TiD, TiDefault, TiDerivedInstances, TiDkc, TiDs, TiE, TiError, TiHsName, TiModule, TiNames, TiPNT, PNT, ScopeModule, UniqueNames, ParseMonad, SourceNames, Deriving, DerivingUtils, RemoveListComp, SimpFieldLabels, SimpFunBind, ConvRefsTypes, HLex2html, RefsTypes, PFEdeps, Pfe2Cmds, Pfe4Cmds, PfeDepCmds, HsPropStruct, TiPropStruct, PropSyntaxStruct, ToQC.

module SrcLoc(
    SrcLoc(..), -- source location data type
    HasSrcLoc(..), -- source location class
    srcFile,
    loc0)       -- :: SrcLoc, initial dummy location
  where

data SrcLoc = SrcLoc {srcPath::FilePath,
		      srcChar,srcLine,srcColumn:: !Int }
  deriving (Eq,Ord)

instance Show SrcLoc where
   showsPrec p (SrcLoc f n l c) = showsPrec p (f,n,l,c)

instance Read SrcLoc where
   readsPrec p s = [(SrcLoc f n l c,r)|((f,n,l,c),r)<-readsPrec p s]

class HasSrcLoc syntax where 
  srcLoc :: syntax -> SrcLoc

srcFile x = srcPath (srcLoc x)

loc0 = SrcLoc "__unknown__" 0 0 0

instance HasSrcLoc s => HasSrcLoc [s] where
  srcLoc [] = loc0
  srcLoc (x:xs) = srcLoc x

instance HasSrcLoc SrcLoc where srcLoc = id

Index

(HTML for this module was generated on 2006-08-12. About the conversion tool.)