Last active
May 6, 2019 20:14
-
-
Save owen-d/9d098a1177288d8c9203577d52ee7bc9 to your computer and use it in GitHub Desktop.
maybe typescript
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
// This excludes us from trying to use (Maybe null) sensibly. | |
export type Maybe<T> = T | null | |
export function isJust<T>(x: Maybe<T>): x is T { | |
return x !== null | |
} | |
export function isNothing<T>(x: Maybe<T>): x is null { | |
return x === null | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment