title: Getting a value from a custom datatype
body: <p>I have a custom data type in Haskell. I have a custom type from which I later want to get a property and output it. In Java I would just go through the properties with the . (dot) operator, however this doesn't work in Haskell. How would I go about doing this?</p>
  <p>This is the code I have now</p>
  <pre><code>data Person = P Name Address
  type Name = String
  type Address = String
  
  x :: Person 
  x = (P &quot;abc&quot; &quot;def&quot;)
  
  y :: Name
  y = x.Name
  
  main :: IO ()
  main = putStrLn $ &quot;The name is: &quot; ++ y
  </code></pre>