Created
May 21, 2020 17:44
-
-
Save chuckadams/8efb8f1f75836a68609ea4b5541c1efb to your computer and use it in GitHub Desktop.
dependent types in typescript
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 Maybe<a> = { val: a, tag = "some" } | { tag: "none" } | |
function isSome<A, Ma: Maybe<a>>(m: Ma): Ma["val"] is A { | |
return m.tag == "some"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment