HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulemonoid-subclasses-1.2.5.1Haskell2010

Data.Monoid.Instances.Positioned

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 StableFactorial. 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.

Line number is zero-based, column one-based:

> let p = pure "abcd\nefgh\nijkl\nmnop\n" :: LinePositioned String
> p
"abcd\nefgh\nijkl\nmnop\n"
> Data.Monoid.Factorial.drop 13 p
Line 2, column 4: "l\nmnop\n"
  • 2 types
  • 2 values
datadata OffsetPositioned m
#
Instances20Functor, Applicative, Positioned, Eq, Data, Ord, …
datadata LinePositioned m
#
Instances20Functor, Applicative, Positioned, Eq, Data, Ord, …