Created
May 25, 2015 12:00
-
-
Save gsg/51880d915b5cc6f29f10 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type _ expr = | |
| Num : int -> int expr | |
| Add : int expr * int expr -> int expr | |
| Lt : int expr * int expr -> bool expr | |
let rec eval (type a) (expr : a expr) : a = | |
match expr with | |
| Num n -> n | |
| Add (a, b) -> eval a + eval b | |
| Lt (a, b) -> eval a < eval b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment