Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines two monoid transformer data types, OffsetPositioned
and LinePositioned
. Both data types add
a notion of the current position to their base monoid. In case of OffsetPositioned
, the current position is a
simple integer offset from the beginning of the monoid, and it can be applied to any StableFactorialMonoid
. The
base monoid of LinePositioned
must be a TextualMonoid
, but for the price it will keep track of the current line
and column numbers as well.
- data OffsetPositioned m
- data LinePositioned m
- extract :: Positioned p => p a -> a
- position :: Positioned p => p a -> Int
- line :: LinePositioned m -> Int
- column :: LinePositioned m -> Int
- findIndex :: FactorialMonoid a => (OffsetPositioned a -> Bool) -> OffsetPositioned a -> Int
- findPosition :: FactorialMonoid m => (OffsetPositioned m -> Bool) -> OffsetPositioned m -> Int
Documentation
data OffsetPositioned m Source
Functor OffsetPositioned | |
Applicative OffsetPositioned | |
Eq m => Eq (OffsetPositioned m) | |
Ord m => Ord (OffsetPositioned m) | |
Show m => Show (OffsetPositioned m) | |
IsString m => IsString (OffsetPositioned m) | |
StableFactorialMonoid m => Monoid (OffsetPositioned m) | |
(StableFactorialMonoid m, PositiveMonoid m) => PositiveMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, MonoidNull m) => MonoidNull (OffsetPositioned m) | |
StableFactorialMonoid m => StableFactorialMonoid (OffsetPositioned m) | |
StableFactorialMonoid m => FactorialMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, RightGCDMonoid m) => RightGCDMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, LeftGCDMonoid m) => LeftGCDMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, RightReductiveMonoid m) => RightReductiveMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, LeftReductiveMonoid m) => LeftReductiveMonoid (OffsetPositioned m) | |
(StableFactorialMonoid m, TextualMonoid m) => TextualMonoid (OffsetPositioned m) |
data LinePositioned m Source
line :: LinePositioned m -> Int Source
the current line
column :: LinePositioned m -> Int Source
the current column
findIndex :: FactorialMonoid a => (OffsetPositioned a -> Bool) -> OffsetPositioned a -> Int Source
findPosition :: FactorialMonoid m => (OffsetPositioned m -> Bool) -> OffsetPositioned m -> Int Source