Last active
July 19, 2018 21:56
-
-
Save kennetpostigo/cb06a40319aceaeae8fb1ee2b5cb0833 to your computer and use it in GitHub Desktop.
ExistentialTypesExample from Universal and Existential Types blog post
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
/* link to playground: https://bit.ly/2uP4SgO */ | |
module type Animal = { | |
type t; | |
let make: (string) => t; | |
let sprint: (t) => string; | |
}; | |
module Animal: Animal = { | |
type t = string; | |
let make = (name) => name; | |
let sprint = a => {j|$a is running!|j}; | |
}; | |
let zebra = Animal.make("Zebra"); | |
Js.log(Animal.sprint(zebra)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment