Okay, as someone who came from Object-Oriented programming not a week ago, Haskell is somewhat overwhelming - its likely that this has been answered, but all my research has been fruitless. Please bear with me.
Say that I have two algebraic data types:
data Person = Person {name :: String, houseNumber :: Integer, hasBorrowed :: Bool}
data Book = Book {borrower :: Person, title :: String}
Now, I know that you can simply extract a value from a single algebraic data type with a function:
getHouseNumber :: Person -> Integer
getHouseNumber (Person _ houseNumber _) = houseNumber
getBorrower :: Book -> Person
getBorrower (Book borrower _) = borrower
My question is (and I swear I'm going to smack myself in the head when I get the answer) how would I write a function which extracts houseNumber (as an example) straight from book? In other words:
getHouseNumberFromBook :: Book -> Integer
Thanks in advance.