Created
December 18, 2023 22:04
-
-
Save JamieMason/b9e0a6501982d6c06a87e983a5d2edf4 to your computer and use it in GitHub Desktop.
Try ReScript
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
// looking at an alternative to ReScript's Option | |
// which exists at runtime when compiled to JS | |
type maybe<'a> = { | |
_tag: [#Some], | |
value: 'a, | |
} | |
let createMaybe = (value: 'a): maybe<'a> => { | |
{ | |
_tag: #Some, | |
value, | |
} | |
} | |
let x = createMaybe(11) | |
let y = createMaybe("hello") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment