Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Created December 18, 2023 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieMason/b9e0a6501982d6c06a87e983a5d2edf4 to your computer and use it in GitHub Desktop.
Save JamieMason/b9e0a6501982d6c06a87e983a5d2edf4 to your computer and use it in GitHub Desktop.
Try ReScript
// 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