Modules 25
Text.Parsec.Pos
provisionalTextual source positions.
type Line = Int
type Column = Int
data SourcePos
The abstract data type SourcePos represents source positions. It
contains the name of the source (i.e. file name), a line number and
a column number. SourcePos is an instance of the Show, Eq and
Ord class.
sourceLine :: SourcePos -> Line
Extracts the line number from a source position.
sourceColumn :: SourcePos -> Column
Extracts the column number from a source position.
sourceName :: SourcePos -> SourceName
Extracts the name of the source from a source position.
incSourceLine :: SourcePos -> Line -> SourcePos
Increments the line number of a source position.
incSourceColumn :: SourcePos -> Column -> SourcePos
Increments the column number of a source position.
setSourceLine :: SourcePos -> Line -> SourcePos
Set the line number of a source position.
setSourceColumn :: SourcePos -> Column -> SourcePos
Set the column number of a source position.
setSourceName :: SourcePos -> SourceName -> SourcePos
Set the name of the source.
newPos :: SourceName -> Line -> Column -> SourcePos
Create a new SourcePos with the given source name,
line number and column number.
initialPos :: SourceName -> SourcePos
Create a new SourcePos with the given source name,
and line number and column number set to 1, the upper left.
updatePosChar :: SourcePos -> Char -> SourcePos
Update a source position given a character. If the character is a newline ('\n') or carriage return ('\r') the line number is incremented by 1. If the character is a tab ('t') the column number is incremented to the nearest 8'th column, ie. @column + 8 - ((column-1) `mod` 8)@. In all other cases, the column is incremented by 1.
updatePosString :: SourcePos -> String -> SourcePos
The expression updatePosString pos s updates the source position
pos by calling updatePosChar on every character in s, ie.
foldl updatePosChar pos string.
Instances
5
instance Eq SourcePosinstance Ord SourcePosinstance Data SourcePosinstance Typeable SourcePosinstance Show SourcePos
- Maintainer
- derek.a.elkins@gmail.com
- Portability
- portable
- Copyright
- (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007
- License
- BSD-style (see the LICENSE file)
Build record and source files
Community contribution. The service has not verified this documentation. The generator reported 3 diagnostics.
Target: Linux on x86-64. Some inferred types and resolved links are not available.
Generator: aihc-haddock-858b1951-web-1
Metadata snapshot: 51a8c38adf37e9558e7835b04b20868626c044e2d2e98e3527943eabd1e09c0a
Open the dependency plan · Download the documentation model
- aihc-base-4.21.2.0 · Core library · Cabal file
- aihc-internal-9.1204.0 · Core library · Cabal file
- aihc-prim-0.13.0 · Core library · Cabal file
- aihc-rts-1.0.2 · Core library · Cabal file
- aihc-template-haskell-2.23.0.0 · Core library · Cabal file
- array-0.5.8.0 · Cabal revision 2 · Cabal file · Source archive
- binary-0.8.9.3 · Cabal revision 0 · Cabal file · Source archive
- bytestring-0.12.2.0 · Cabal revision 1 · Cabal file · Source archive
- containers-0.8.1 · Cabal revision 0 · Cabal file · Source archive
- deepseq-1.5.2.0 · Cabal revision 0 · Cabal file · Source archive
- mtl-2.3.2 · Cabal revision 1 · Cabal file · Source archive
- parsec-3.1.18.0 · Cabal revision 1 · Cabal file · Source archive
- system-cxx-std-lib-1.0 · Core library · Cabal file
- text-2.1.4 · Cabal revision 0 · Cabal file · Source archive
- transformers-0.6.3.0 · Cabal revision 2 · Cabal file · Source archive