curry-base-1.1.0: Functions for manipulating Curry programs

Copyright(c) Wolfgang Lux
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Curry.Base.Position

Contents

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.

Synopsis

Source code position

class HasPosition a where Source #

Type class for entities which have a source code Position

Minimal complete definition

Nothing

Methods

getPosition :: a -> Position Source #

Get the Position

setPosition :: Position -> a -> a Source #

Set the Position

Instances
HasPosition Position Source # 
Instance details

Defined in Curry.Base.Position

HasPosition Message Source # 
Instance details

Defined in Curry.Base.Message

HasPosition Span Source # 
Instance details

Defined in Curry.Base.Span

HasPosition SpanInfo Source # 
Instance details

Defined in Curry.Base.SpanInfo

HasPosition QualIdent Source # 
Instance details

Defined in Curry.Base.Ident

HasPosition Ident Source # 
Instance details

Defined in Curry.Base.Ident

HasPosition ModuleIdent Source # 
Instance details

Defined in Curry.Base.Ident

HasPosition Extension Source # 
Instance details

Defined in Curry.Syntax.Extension

HasPosition Constraint Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition QualTypeExpr Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition TypeExpr Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition FieldDecl Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition NewConstrDecl Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition ConstrDecl Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition Import Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition ImportSpec Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition ImportDecl Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition Export Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition ExportSpec Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition ModulePragma Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Goal a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Field a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Alt a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Statement a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (InfixOp a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Expression a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Pattern a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (CondExpr a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Rhs a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Lhs a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Equation a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Decl a) Source # 
Instance details

Defined in Curry.Syntax.Type

HasPosition (Module a) Source # 
Instance details

Defined in Curry.Syntax.Type

data Position Source #

Source code positions

Constructors

Position

Normal source code position

Fields

NoPos

no position

(@>) :: (HasPosition a, HasPosition b) => a -> b -> a Source #

x @> y returns x with the position obtained from y

ppPosition :: Position -> Doc Source #

Pretty print a Position

ppLine :: Position -> Doc Source #

Pretty print the line and column of a Position

showLine :: Position -> String Source #

Show the line and column of a Position

first :: FilePath -> Position Source #

Absolute first position of a file

next :: Position -> Position Source #

Next position to the right

incr :: Position -> Int -> Position Source #

Increment a position by a number of columns

tab :: Position -> Position Source #

First position after the next tabulator

tabWidth :: Int Source #

Number of spaces for a tabulator

nl :: Position -> Position Source #

First position of the next line