package alg_structs
Module Int.SumSource
op is (+) and unit is 0
include Semigroup.S with type t = int
include Semigroup.Seed with type t = int
The principle (and sole) type.
We can think of this set-theoretically as the carrier set of the algebraic structure or category-theoretically as the single object in the category, with each element being a morphism t -> t.
val concat : t NonEmptyList.t -> tconcat xs is the concatenation of all elements of xs into a single value using op.
This is equivalent to List.fold_right op (NonEmptyList.tl xs) (NonEmptyList.hd xs).
val unit : tmconcat xs is the concatenation of all elements in xs into a single value, derived by use of op.
This is equivalent to List.fold_right op xs unit.
The initial m marks this as monoidal concatenation rather than the concat function inherited from the underlying Semigroup. Since mconcat can use the unit to prime the fold, it can work over a normal list, in contrast to concat.