Copyright | (c) Wolfgang Lux |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | experimental |
Portability | non-portable (DeriveDataTypeable) |
Safe Haskell | None |
Language | Haskell2010 |
Curry.Base.Position
Description
This module implements a data type for positions in a source file and respective functions to operate on them. A source file position consists of a filename, a line number, and a column number. A tab stop is assumed at every eighth column.
In addition, the type SrcRef
identifies the path to an expression in
the abstract syntax tree by argument positions, which is used for
debugging purposes.
- class HasPosition a where
- data Position
- (@>) :: (HasPosition a, HasPosition b) => a -> b -> a
- showPosition :: Position -> String
- ppPosition :: Position -> Doc
- ppLine :: Position -> Doc
- showLine :: Position -> String
- first :: FilePath -> Position
- next :: Position -> Position
- incr :: Position -> Int -> Position
- tab :: Position -> Position
- tabWidth :: Int
- nl :: Position -> Position
- incPosition :: Position -> Int -> Position
- newtype SrcRef = SrcRef [Int]
- class SrcRefOf a where
- srcRef :: Int -> SrcRef
- noRef :: SrcRef
- mk :: (SrcRef -> a) -> a
- mk' :: ([SrcRef] -> a) -> a
- incSrcRef :: SrcRef -> Int -> SrcRef
Source code position
class HasPosition a where Source #
Type class for entities which have a source code Position
Methods
getPosition :: a -> Position Source #
Get the Position
setPosition :: Position -> a -> a Source #
Set the Position
Source code positions
(@>) :: (HasPosition a, HasPosition b) => a -> b -> a Source #
x @> y
returns x
with the position obtained from y
incPosition :: Position -> Int -> Position Source #
Increment the position in the abstract syntax tree
source reference
A pointer to the origin