| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Monoid.Instances.Positioned
Description
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.
All positions are zero-based:
> let p = pure "abcd\nefgh\nijkl\nmnop\n" :: LinePositioned String > p Line 0, column 0: "abcd\nefgh\nijkl\nmnop\n" > Data.Monoid.Factorial.drop 13 p Line 2, column 3: "l\nmnop\n"
- 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
Documentation
data OffsetPositioned m Source
Instances
data LinePositioned m Source
Instances
line :: LinePositioned m -> Int Source
the current line
column :: LinePositioned m -> Int Source
the current column