Last active
January 7, 2019 17:54
-
-
Save vvviiimmm/a33796f14e09f49349207adaf646e20e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
{ name :: String | |
, age :: Int | |
, address :: Address | |
} | |
-- Using type constructor | |
person = Person "Bob" 42 | |
-- Or using records notation | |
person = Person {name = "Bob", age = 42} | |
-- Accessing fields | |
personsName = name person -- "Bob" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment