Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Created May 25, 2015 10:33
Show Gist options
  • Save bjartwolf/e00fcb0a4e835578c6f9 to your computer and use it in GitHub Desktop.
Save bjartwolf/e00fcb0a4e835578c6f9 to your computer and use it in GitHub Desktop.
person.fs
type Person = { id: Guid; name: string; age: int}
let bjorn = { id=System.Guid.NewGuid(); name="Bjørn Einar"; age=34}
let changedName = {bjorn with name = "Bjørn the confused"}
let changeAge (p:Person) (newAge:int) =
// somecrazybusiness rules with age and using services to check if the
// age is really correct and do all kinds of sideeffects
{p with age = newAge}
let changedAgedBjorn = changeAge changedName 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment