Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module deals with updating spans of characters in values of type Text.
It defines some helper types and functions to apply these "updates".
- data SpanUpdate = SpanUpdate {}
- data SourcePos = SourcePos {}
- data SourceSpan = SourceSpan {}
- updateSpan :: SpanUpdate -> Text -> Text
- updateSpans :: [SpanUpdate] -> Text -> Text
- linearizeSourcePos :: Text -> Int64 -> Int64 -> Int64
- prettyPrintSourcePos :: SourcePos -> String
Documentation
data SpanUpdate Source #
A span and some text to replace it with. They don't have to be the same length.
A position in a text file
data SourceSpan Source #
A span of characters with a beginning and an end.
spanEnd
must be greater than spanBegin
updateSpan :: SpanUpdate -> Text -> Text Source #
Update a single span of characters inside a text value. If you're updating
multiples spans it's best to use updateSpans
.
updateSpans :: [SpanUpdate] -> Text -> Text Source #
Update many spans in a file. They must be non-overlapping.