Skip to content

Commit 0a36d9c

Browse files
committed
docs: mention AtCoder.Extra.Monoid in AtCoder.Extra.LazySegTree
1 parent 9d6eed1 commit 0a36d9c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/AtCoder/LazySegTree.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
-- - Acting the map \(f\in F\) (cf. \(x = f(x)\)) on all the elements of an interval
1515
-- - Calculating the product of the elements of an interval
1616
--
17-
-- In Haskell types, \(F\) is a `SegAct` (@'segAct' f@) and \(S\) is a `Monoid`. For simplicity, in
18-
-- this document, we assume that the relevant methods work in constant time. If these work in
19-
-- \(O(T)\) time, each time complexity appear in this document is multiplied by \(O(T)\).
17+
-- In Haskell types, \(F\) is a `SegAct` (@'segAct' f@) and \(S\) is a `Monoid`. You would want to
18+
-- look into @AtCoder.Extra.Monoid@ for builtin monoid action types. For example, there's no
19+
-- implementation of @SegAct (Sum Int) (Sum Int)@, but you have @SegAct (RangeAdd Int) (Sum Int)@.
20+
--
21+
-- For simplicity, in this document, we assume that the relevant methods work in constant time. If
22+
-- these work in \(O(T)\) time, each time complexity appear in this document is multiplied by
23+
-- \(O(T)\).
2024
--
2125
-- ==== __Example__
2226
-- Here we'll use `AtCoder.Extra.Monoid.Affine1` as a monoid action \(F\) and `Data.Semigroup.Sum`
@@ -66,6 +70,7 @@
6670
--
6771
-- ==== Tips
6872
--
73+
-- - See @AtCoder.Extra.Monoid@ for builtin monoid action types.
6974
-- - `prod` returns \(a_l \cdot a_{l + 1} \cdot .. \cdot a_{r - 1}\). If you need \(a_{r - 1} \cdot a_{r - 2} \cdot .. \cdot a_{l}\),
7075
-- wrap your monoid in `Data.Monoid.Dual`.
7176
-- - If you ever need to store boxed types to `LazySegTree`, wrap it in @Data.Vector.Unboxed.DoNotUnboxStrict@
@@ -133,7 +138,7 @@ import GHC.Stack (HasCallStack)
133138
import Prelude hiding (read)
134139

135140
-- | Typeclass reprentation of the `LazySegTree` properties. User can implement either `segAct` or
136-
-- `segActWithLength`.
141+
-- `segActWithLength`. See @AtCoder.Extra.Monoid@ for builtin monoid action types.
137142
--
138143
-- Instances should satisfy the follwing properties:
139144
--
@@ -150,7 +155,7 @@ import Prelude hiding (read)
150155
-- order is important for non-commutative monoid implementations.
151156
--
152157
-- ==== __Example instance__
153-
-- Take `AtCoder.Extra.Monoid.Affine1` as an example of type \(F\).
158+
-- Take `AtCoder.Extra.Monoid.Affine1` as an example of type \(F\) instance.
154159
--
155160
-- @
156161
-- {-# LANGUAGE TypeFamilies #-}

0 commit comments

Comments
 (0)