Last active
August 9, 2020 19:56
-
-
Save friedbrice/5bdc1a05ee881388c4fe0099ed61fddf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Address = { | |
street: string | |
zipCode: string | |
} | |
type Contact = { | |
name: string | |
phoneNumber: string | |
email: string | |
} | |
type User = Address & Contact | |
const printUser = (user: User) => ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Address = Address { street :: String, zipCode :: String } | |
data Contact = Contact { name :: String, phoneNumber :: String, email :: String } | |
type User = (Address, Contact) | |
printUser :: User -> String | |
printUser (address, contact) = | |
let | |
Address { street = s, zipCode = z } = address | |
Contact { name = n, phoneNumber = p, email = e } = contact | |
in | |
n ++ ", " ++ p ++ ", " ++ e ++ "\n" ++ s ++ ", " ++ z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment