Monoids is a library of a set of generic Monoid
and Semigroup
types that are very useful for abstract programming.
This library exposes some generic Monoid
s:
All
- Boolean newtype that combines values using&&
Any
- Boolean newtype that combines values using||
Dual
- Inverts the Combine operation of a monoidFirst
- Option newtype that combine takes the first element that is presentLast
- Option newtype that combine takes the last element that is presentProduct
- Numeric newtype that combines values using MultiplicationSum
- Numeric newtype that combines values using Addition
Also some generic Semigroup
s:
Dual
inverts the combine operation.Max
exposes a Max that given anOrder
will return the maximum value.Min
exposes a Min that given anOrder
will return the minimum value.
To use this project in an existing SBT project with Scala 2.12 or a later version, add the following dependencies to your
build.sbt
depending on your needs:
libraryDependencies ++= Seq(
"org.typelevel" %%% "monoids" % "<version>"
)