Created
March 4, 2015 12:16
-
-
Save shigemk2/4f1444982d4dbf816907 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
-- さっきより、良い書き方 | |
data Person = Person { firstName :: String | |
, lastName :: String | |
, age :: Int | |
, height :: Float | |
, phoneNumber :: String | |
, flavor :: String } deriving (Show) | |
-- firstName :: Person -> String | |
-- firstName (Person firstname _ _ _ _ _) = firstname | |
-- lastName :: Person -> String | |
-- lastName (Person _ lastname _ _ _ _) = lastname | |
-- age :: Person -> Int | |
-- age (Person _ _ age _ _ _) = age | |
-- height :: Person -> Float | |
-- height (Person _ _ _ height _ _) = height | |
-- phoneNumber :: Person -> String | |
-- phoneNumber (Person _ _ _ _ number _) = number | |
-- flavor :: Person -> String | |
-- flavor (Person _ _ _ _ _ flavor) = flavor | |
main = do | |
print guy | |
print $ firstName guy | |
print $ height guy | |
print $ flavor guy | |
where | |
guy = Person "Buddy" "Finklestein" 43 184.2 "526-2928" "Chocolate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment