Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Created December 3, 2015 12:15
Show Gist options
  • Save ccapndave/be3ec494b286b8d70f82 to your computer and use it in GitHub Desktop.
Save ccapndave/be3ec494b286b8d70f82 to your computer and use it in GitHub Desktop.
type alias RDoc a = { a | id : Int }
type alias RUser = RDoc { userName : String }
type alias RGroup = RDoc { groupName : String }
type RSelectedDoc
= RSelectedUser RUser
| RSelectedGroup RGroup
rselectedDocToDoc : RSelectedDoc -> RDoc a
rselectedDocToDoc selectedDoc =
case selectedDoc of
RSelectedUser user -> { id = user.id }
RSelectedGroup group -> { id = group.id }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment