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
// In F# if we have a record and instance: | |
type RecordOne = { | |
PropOne: string | |
PropTwo: int | |
} | |
let recordOne = { PropOne = "PropOne"; PropTwo = 1 } | |
// it can then be updated as so: |
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
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 |