Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Created December 3, 2015 11:36
Show Gist options
  • Save ccapndave/edd4d52df97315d49049 to your computer and use it in GitHub Desktop.
Save ccapndave/edd4d52df97315d49049 to your computer and use it in GitHub Desktop.
type alias Doc a = { a | id : Int }
type alias User = Doc { userName : String }
type alias Group = Doc { groupName : String }
user1 = { id = 1, userName = "dave" }
group1 = { id = 100, groupName = "some group" }
getIdFromDoc : Doc a -> Int
getIdFromDoc doc = doc.id
id1 = getIdFromDoc user1
id2 = getIdFromDoc group1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment