typelevel / algebra

Experimental project to lay out basic algebra type classes
https://typelevel.org/algebra/
Other
378 stars 69 forks source link

Add AdjoinedUnit to create a Ring from a Rng #64

Open johnynek opened 9 years ago

johnynek commented 9 years ago

See:

https://github.com/twitter/algebird/blob/develop/algebird-core/src/main/scala/com/twitter/algebird/AdjoinedUnitRing.scala

Like you can always use Option[T] to lift a Semigroup to a Monoid, you can always adjoin a unit element to any Rng to create a Ring. This is useful to create a Ring[Map[K, V]] where there is a Ring[V], without this, there is no unit map.