title: Elm Pattern matching on Generic Data Structure
body: <p>Given this code:</p>
  <pre><code>type Msg 
      = NoOp
      | UpdateField ReqRes
  
  
  type ReqRes a
      = Request a
      | Response (Result Http.Error Bool)
  
  
  update : Msg -&gt; Model -&gt; (Model, Cmd Msg)
  update msg model =
      case msg of
          UpdateField reqres -&gt;
              case reqres of
                  Request a -&gt;
                      -- Do stuff
                  Response result -&gt;
                      -- Do stuff
          _ -&gt; 
              -- Do stuff
  </code></pre>
  <p>So as you can See I have a Msg named UpdateField, that takes the UnionType ReqRes. So far so good. But the Union Type has a Generic Data Structure (or contains a Type variable ... does this both mean the same???).</p>
  <p>My Problem is now, that I do not know how to pattern match on this.</p>
  <p>The Compiler tells me this error:</p>
  <blockquote>
  <p>... Problem in this pattern match</p>
  <p>The pattern matches things of type:</p>
  <pre><code>ReqRes a
  </code></pre>
  <p>But the values it will actually be trying to match here are:</p>
  <pre><code>ReqRes
  </code></pre>
  </blockquote>