Skip to content

Instantly share code, notes, and snippets.

@dsshep
Created September 26, 2022 19:05
Show Gist options
  • Save dsshep/87f7a7fbc6412a61c31f05cd8abb5f53 to your computer and use it in GitHub Desktop.
Save dsshep/87f7a7fbc6412a61c31f05cd8abb5f53 to your computer and use it in GitHub Desktop.
module Age =
type Age = private Age of int
let create (age : int) : Age option =
if age < 0 then None else Some (Age age)
module Application =
let invalidAge = Age.create -1 // none
let validAge = Age.create 10 // some
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment