Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Coord = Coord' Int Int
- data Coord' a b = Coord {}
- overRow :: (Int -> Int) -> Coord -> Coord
- overCol :: (Int -> Int) -> Coord -> Coord
- overBoth :: Bifunctor f => (a -> b) -> f a a -> f b b
- coordRow :: forall a b a. Lens (Coord' a b) (Coord' a b) a a
- coordCol :: forall a b b. Lens (Coord' a b) (Coord' a b) b b
- newtype Offset = Offset Int
- asCoord :: YiString -> Iso' Offset Coord
- clampCoord :: YiString -> Coord -> Coord
- clampRange :: YiString -> CrdRange -> CrdRange
- data Range a b = Range {}
- type CrdRange = Range Coord Coord
- range :: CrdRange -> Lens' YiString YiString
- rStart :: forall a b a. Lens (Range a b) (Range a b) a a
- rEnd :: forall a b b. Lens (Range a b) (Range a b) b b
- sizeOf :: YiString -> Coord
- sizeOfR :: CrdRange -> Coord
- moveRange :: Coord -> CrdRange -> CrdRange
- moveRangeByN :: Int -> CrdRange -> CrdRange
- moveCursorByN :: Int -> Coord -> Coord
- moveCursor :: Coord -> Coord -> Coord
- data Span a b = Span a b
- combineSpans :: forall a. Monoid a => [Span CrdRange 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
overBoth :: Bifunctor f => (a -> b) -> f a a -> f b b Source #
Applies a function over both functors in any Bifunctor
.
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 -> CrdRange -> CrdRange 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
)
type CrdRange = Range Coord Coord Source #
A type alias to Range'
which specializes the types to Coord
s.
range :: CrdRange -> Lens' YiString YiString Source #
A lens over text which is encompassed by a Range
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.
Span a b |
combineSpans :: forall a. Monoid a => [Span CrdRange 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.