typelevel / algebra

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

add Kleene Algebra #169

Open johnynek opened 8 years ago

johnynek commented 8 years ago

https://en.wikipedia.org/wiki/Kleene_algebra

This is always fun. We could have a method to get the BoundedSemilattice from the + operation.

I guess this extends Rig. So something like:

trait KleeneAlgebra[A] extends Rig[A] {
  def star(a: A): A
  def additiveSemilattice: BoundedSemilattice[A]
}
non commented 8 years ago

There are actually two structures: star rigs and kleene algebras. They have the same structure but different laws.

For example: http://r6.ca/blog/20110808T035622Z.html