Skip to content

Instantly share code, notes, and snippets.

@mlms13
Created May 14, 2020 03:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mlms13/fcca059960dc4d79826e1bafbb1c8150 to your computer and use it in GitHub Desktop.
Combining bs-deriving with Bastet's expected function names
module Face = {
[@deriving (enum, ord, eq)]
type t =
| Blank
| One
| Two
| Three
| Four
| Five
| Six
| Seven
| Eight
| Nine
| Ten
| Eleven
| Twelve;
let eq = (a: t, b: t) => a == b;
let compare = (a: t, b: t) => Relude.Ordering.fromInt(compare(a, b));
let toEnum = of_enum;
let fromEnum = to_enum;
let cardinality = max + 1;
let succ = v => toEnum(fromEnum(v) + 1);
let pred = v => toEnum(fromEnum(v) - 1);
let bottom = Blank;
let top = Twelve;
};
type t =
| Domino(Face.t, Face.t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment