Skip to content

Instantly share code, notes, and snippets.

@kennetpostigo
Last active June 23, 2018 00:42
Show Gist options
  • Save kennetpostigo/b5fa29525cc875329f0914dd92d1469c to your computer and use it in GitHub Desktop.
Save kennetpostigo/b5fa29525cc875329f0914dd92d1469c to your computer and use it in GitHub Desktop.
Reason Phantom Type Animal module type
module type Animal = {
/* Define abstract types t, dog, and cat */
type t('a);
type dog;
type cat;
/* helpers to create a type dog or cat */
let makeDog: string => t(dog);
let makeCat: string => t(cat);
let mate: (t('a), t('a)) => string;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment