Skip to content

Instantly share code, notes, and snippets.

@kkismd
Created April 11, 2016 05:50
Show Gist options
  • Select an option

  • Save kkismd/3d6ff3abc664b24b1d464bd92c38c5a7 to your computer and use it in GitHub Desktop.

Select an option

Save kkismd/3d6ff3abc664b24b1d464bd92c38c5a7 to your computer and use it in GitHub Desktop.
data Person = Person { firstName :: String, lastName :: String } deriving Show
data DisplayPerson = DisplayPerson { name :: String } deriving Show
names :: Person -> [String]
names person = [firstName person, lastName person]
translate :: Person -> DisplayPerson
translate = DisplayPerson . unwords . names
translateR :: Person -> DisplayPerson
translateR = DisplayPerson . unwords . reverse . names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment