Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Coord = Coord Int Int
- newtype Offset = Offset Int
- asCoord :: YiString -> Iso' Offset Coord
- clampCoord :: YiString -> Coord -> Coord
- clampRange :: YiString -> Range -> Range
- data Range = Range Coord Coord
- sizeOf :: YiString -> Coord
- sizeOfR :: Range -> Coord
- moveRange :: Coord -> Range -> Range
- moveRangeByN :: Int -> Range -> Range
- moveCursorByN :: Int -> Coord -> Coord
- moveCursor :: Coord -> Coord -> Coord
- data Span a = Span {}
- combineSpans :: forall a. Monoid a => [Span a] -> [(Coord, a)]
- clamp :: Int -> Int -> Int -> Int
- beforeC :: Coord -> Lens' YiString YiString
- afterC :: Coord -> Lens' YiString YiString
Documentation
(Coord Row Column) represents a char in a block of text. (zero indexed) e.g. Coord 0 0 is the first character in the text, Coord 2 1 is the second character of the third row
An Offset
represents an exact position in a file as a number of characters from the start.
clampCoord :: YiString -> Coord -> Coord Source #
This will restrict a given Coord
to a valid one which lies within the given text.
clampRange :: YiString -> Range -> Range Source #
This will restrict a given Range
to a valid one which lies within the given text.
This represents a range between two coordinates (Coord
)
sizeOf :: YiString -> Coord Source #
Returns the number of rows and columns that a chunk of text spans as a Coord
A span which maps a piece of Monoidal data over a range.
combineSpans :: forall a. Monoid a => [Span a] -> [(Coord, a)] Source #
Combines a list of spans containing some monoidal data into a list of offsets with with the data that applies from each Offset forwards.