Skip to content

Instantly share code, notes, and snippets.

@joseph-montanez
Created August 6, 2013 23:57
Show Gist options
  • Save joseph-montanez/6170027 to your computer and use it in GitHub Desktop.
Save joseph-montanez/6170027 to your computer and use it in GitHub Desktop.
get a parameter regardless of record type?
food.fs(25,25): error FS0001: This expression was expected to have type
fruit
but here has type
vegie
type vegie = {
Seeds: int
Name: string
}
type fruit = {
Seeds: int
Name: string
Color: string
}
let countSeeds item = item.Seeds
let apple : fruit = {
Seeds = 8
Name = "Apple"
Color = "Red"
}
let pepper : vegie = {
Seeds = 1024
Name = "Green Bell Pepper"
}
printf "%A" (countSeeds pepper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment