Created
August 12, 2015 06:41
-
-
Save jordwalke/83518e6665b631633aa5 to your computer and use it in GitHub Desktop.
Existential Types Recovering
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 printable = Printable : 'a * ('a-> string) -> printable;; | |
let myList = [Printable (2, string_of_int); Printable (true, string_of_bool)];; | |
let printPrintable: printable -> string = fun p -> | |
let Printable (data, printer) = p in | |
printer data | |
;; | |
let printables = [Printable (2, string_of_int); Printable (true, string_of_bool)];; | |
let results = List.map printPrintable printables;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment