Skip to content

Instantly share code, notes, and snippets.

View lvicentesanchez's full-sized avatar

Luis Angel Vicente Sanchez lvicentesanchez

View GitHub Profile
@lvicentesanchez
lvicentesanchez / monoid.rs
Created April 7, 2016 14:02
Monoid implementation in Rust
trait Empty {
fn empty() -> Self;
}
trait Semigroup {
fn append(&self, other: Self) -> Self;
}
trait Monoid : Semigroup+Empty {}
// Simple module type...
//
trait Ordering {
type T
def cmp(a: T, b: T): Int
}
// ...and implementation
//