Skip to content

Instantly share code, notes, and snippets.

@archena
Created October 24, 2013 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archena/7144315 to your computer and use it in GitHub Desktop.
Save archena/7144315 to your computer and use it in GitHub Desktop.
interface Semigroup<T> {
T apply(T a, T b);
}
interface Monoid<T> extends Semigroup<T> {
T identity();
}
interface Group<T> extends Monoid<T> {
T inverse(T a);
}
class Ring<T> {
public final Monoid<T> m;
public final Group<T> a;
public Ring(Monoid<T> m, Group<T> a) {
this.m = m;
this.a = a;
}
}
class Field<T> {
public final Group<T> m, a;
public Field(Group<T> m, Group<T> a) {
this.m = m;
this.a = a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment