title: Accessing elements of custom type variables in Haskell?
body: <p>I have a type called Animal which includes the animal's family and the color of the animal.</p>
  
  <pre><code>type Animal family = [(family, color)]
  
  data Family = Ape | Bear | Bird | Cat | Dog | Chicken
  
  data Color = Brown | Black | White | Other
  </code></pre>
  
  <p>I also have a function in which I am trying to access the family and color of an animal. All I am asking is simply <em>how</em> to access these elements from within a function. For example in most object oriented languages we would access these elements with something like <em>animal.family</em>.</p>
  
  <pre><code>animalFunction :: Animal -&gt; String
  animalFunction animal
      | animal.family == Ape = "This animal is an ape."
  </code></pre>