https://github.com/typelevel/monoids
Generic Monoids for Scala
https://github.com/typelevel/monoids
Last synced: 8 months ago
JSON representation
Generic Monoids for Scala
- Host: GitHub
- URL: https://github.com/typelevel/monoids
- Owner: typelevel
- License: mit
- Created: 2018-11-19T22:56:29.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-07-06T06:35:01.000Z (9 months ago)
- Last Synced: 2025-07-21T18:52:08.426Z (8 months ago)
- Language: Scala
- Homepage: https://typelevel.org/monoids/
- Size: 1.49 MB
- Stars: 52
- Watchers: 6
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# monoids  [](https://maven-badges.herokuapp.com/maven-central/org.typelevel/monoids_2.13)
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 monoid
- `First` - Option newtype that combine takes the first element that is present
- `Last` - Option newtype that combine takes the last element that is present
- `Product` - Numeric newtype that combines values using Multiplication
- `Sum` - Numeric newtype that combines values using Addition
Also some generic `Semigroup`s:
- `Dual` inverts the combine operation.
- `Max` exposes a Max that given an `Order` will return the maximum value.
- `Min` exposes a Min that given an `Order` will return the minimum value.
## [Head on over to the Microsite](https://typelevel.org/monoids/)
## Quick Start
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:
```scala
libraryDependencies ++= Seq(
"org.typelevel" %%% "monoids" % ""
)
```