1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
module ACSpans.Span where -- |Position type Pos = (Int, Int) -- |Span (start and end position) type Span = (Pos, Pos) -- |start position of a span start :: Span -> Pos start = fst -- |end position of a span end :: Span -> Pos end = snd startPos :: Pos startPos = (1,1) -- |Virtual position for AST-elements that have no "physical" positions like -- e.g. the import of Prelude virtualPos :: Pos virtualPos = (0, 0) -- |Virtual span for AST-elements that have no "physical" spans like -- e.g. the import of Prelude virtualSpan :: Span virtualSpan = (virtualPos, virtualPos) -- |Is a position a virtual position? isVirtualPos :: Pos -> Bool isVirtualPos p = p == virtualPos |