Created
May 14, 2020 03:51
-
-
Save mlms13/fcca059960dc4d79826e1bafbb1c8150 to your computer and use it in GitHub Desktop.
Combining bs-deriving with Bastet's expected function names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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