Text.Trifecta.Delta

trifecta-1.5.2: A modern parser combinator library with convenient diagnostics

Copyright | (C) 2011-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Safe
Language | Haskell2010

Text.Trifecta.Delta

Description

Synopsis

- data Delta
  - = Columns !Int64 !Int64
  - | Tab !Int64 !Int64 !Int64
  - | Lines !Int64 !Int64 !Int64 !Int64
  - | Directed !ByteString !Int64 !Int64 !Int64 !Int64
- class HasDelta t where
  - delta :: t -> Delta
- class HasBytes t where
  - bytes :: t -> Int64
- nextTab :: Int64 -> Int64
- rewind :: Delta -> Delta
- near :: (HasDelta s, HasDelta t) => s -> t -> Bool
- column :: HasDelta t => t -> Int64
- columnByte :: Delta -> Int64

# Documentation

data Delta

Constructors

Columns !Int64 !Int64 |
Tab !Int64 !Int64 !Int64 |
Lines !Int64 !Int64 !Int64 !Int64 |
Directed !ByteString !Int64 !Int64 !Int64 !Int64 |

Instances

Eq Delta |
Data Delta |
Ord Delta |
Show Delta |
Generic Delta |
Pretty Delta |
Monoid Delta |
Hashable Delta |
Semigroup Delta |
HasDelta Delta |
HasBytes Delta |
Measured Delta Rope |
Measured Delta Strand |
MarkParsing Delta Parser |
type Rep Delta |

class HasDelta t where

Methods

delta :: t -> Delta

Instances

HasDelta Char |
HasDelta Word8 |
HasDelta ByteString |
HasDelta Delta |
HasDelta Rope |
HasDelta Strand |
HasDelta HighlightedRope |
HasDelta Rendering |
HasDelta Caret |
HasDelta (Careted a) |
HasDelta (Rendered a) |
(HasDelta l, HasDelta r) => HasDelta (Either l r) |
(Measured v a, HasDelta v) => HasDelta (FingerTree v a) |

class HasBytes t where

Methods

bytes :: t -> Int64

Instances

HasBytes ByteString |
HasBytes Delta |
HasBytes Rope |
HasBytes Strand |
HasBytes HighlightedRope |
HasBytes Caret |
HasBytes (Careted a) |
HasBytes (Rendered a) |
(Measured v a, HasBytes v) => HasBytes (FingerTree v a) |

nextTab :: Int64 -> Int64

Increment a column number to the next tabstop.

rewind :: Delta -> Delta

Rewind a `Delta` to the beginning of the line.

near :: (HasDelta s, HasDelta t) => s -> t -> Bool

Should we show two things with a `Delta` on the same line?

column :: HasDelta t => t -> Int64

Retrieve the character offset within the current line from this `Delta`.

columnByte :: Delta -> Int64

Retrieve the byte offset within the current line from this `Delta`.