23. レコード構文data Person = Person { firstName :: String
, lastName :: String
, age :: Int
, phoneNumber :: String
} deriving (Show)
data Book = Book { author :: Person
, title :: String
, price :: Int
} derivin (Show)
let author = Person "Saunders" "MacLane" 30 "unknown"
let book = Book author "Categories for the Working Mathematician" 8500
book { author : author book { lastName : "Mac Lane"
, age : 95
, phoneNumber : "unknown"
}
, price : 3000
}コピーして返す(非破壊的)
但しいくつかは新しい値に
再帰的に使える!