title: Haskell: Accessing Elements of a Custom List Type
body: <p>I am new to Haskell and I have a problem with accessing the elements of my custom type.</p>
  
  <p>I have these declarations:</p>
  
  <pre><code>import Data.Char
  import Data.List
  
  data Objekt = Objekt Suit Value
    deriving(Eq,Show)
  data Suit = Hearts | Spades | Diamonds | Clubs
    deriving(Eq,Show)
  data Value = Seven | Eight | Nine | Ten | Jack | Queen | King | Ace
    deriving(Eq,Show)
  
  data Deck = Deck [Objekt]
    deriving(Eq,Show)
  </code></pre>
  
  <p>Now, I'm creating a deck like so:</p>
  
  <p><code>let deck = Deck [Objekt Hearts Seven, Objekt Clubs Queen]</code></p>
  
  <p>and then I want to examine the deck:</p>
  
  <p><code>elem (Objekt Hearts Seven) deck</code></p>
  
  <p>and I get an error:</p>
  
  <pre><code>*Main&gt; elem (Objekt Hearts Seven) deck
  
  &lt;interactive&gt;:8:28: error:
      • Couldn't match expected type ‘[Objekt]’ with actual type ‘Deck’
      • In the second argument of ‘elem’, namely ‘deck’
        In the expression: elem (Objekt Hearts Seven) deck
        In an equation for ‘it’: it = elem (Objekt Hearts Seven) deck
  </code></pre>
  
  <p>The Deck shows the following:</p>
  
  <pre><code>*Main&gt; deck
  Deck [Objekt Hearts Seven,Objekt Clubs Queen]
  *Main&gt; :t Deck
  Deck :: [Objekt] -&gt; Deck
  </code></pre>
  
  <p>No matter what I do (I tried using map or list comprehensions), I can't access the elements of the deck.
  I googled all day but I can't seem to find any example of custom list type and its accessing.</p>
  
  <p>Am I doing the declaration correctly?</p>
  
  <p>How can I test or extract the elements of my deck?</p>
  
  <p>Anyone have an idea?
  Any help would be appreciated...
  Thank you</p>