Skip to content

Instantly share code, notes, and snippets.

@exterm
Last active December 10, 2015 19:39
Show Gist options
  • Select an option

  • Save exterm/4482720 to your computer and use it in GitHub Desktop.

Select an option

Save exterm/4482720 to your computer and use it in GitHub Desktop.
Showing that a function that depends only on a single attribute of a map like data structure is also possible with static records/structs. This allows adding/removing attributes from the record without modification of the all_members function.
data Project = Project {
projId :: String,
projKind :: ProjectKind,
projDescription :: String,
projBudget :: Int,
projTeam :: [Person]
}
all_members :: [Project] -> [Person]
all_members projects = concat $ map projTeam projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment