Created
April 29, 2016 07:44
-
-
Save destrius/85cc9c6f09173850bccd15259946bb53 to your computer and use it in GitHub Desktop.
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
(* Type of data record *) | |
type rectype = CharArray | Number | |
(* My type *) | |
type _ mytype = | |
| String : string mytype | |
| Bool : bool mytype | |
| Int : int mytype | |
(* Check that data record type is compatible with my type *) | |
let validate (type a) (ty : a mytype) (v : rectype) = | |
match (ty, v) with | |
| (String, CharArray) | |
| (Bool, Number) | |
| (Int, Number) -> true | |
| _ -> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment