title: why my attempt to add to the third and fourth element of a tuple in a list dont work?
body: <p>I have to a data Student and a type Class:</p>
  <pre><code>data Student = Student {nome :: String
                          , stdNumber :: Int
                          , approvedClass :: Int
                          , failedClass :: Int
                          }
  type Class = [Student]
  </code></pre>
  <p>and I'm trying to add to All the students in Class more approvednumber and failed of a Student but i'm don't know how to do it . I already have this:</p>
  <pre><code>getStudent :: Class-&gt; String -&gt; Maybe Student
  getStudent [] _ = Nothing
  getStudent (student:xs) s
      | name student == s = Just student
      | otherwise = getStudent xs s
  
  
  addClasses :: Student-&gt; Int -&gt; Int -&gt; Student
  addClasses student aC fC =
      student { approvedClass = approvedClass student + aC
              , failedClass = failedClass student + fC
              }
  
  
  addClassesToAllStd :: Class-&gt; [(String, Int, Int)] -&gt; Class
  addClassesToAllStd cl [] = cl
  addClassesToAllStd  [] _ = []
  addClassesToAllStd ((Student name _ approvedClass failedClass):xs) ((n,aC,fC):ys) = [(Student _ _ approvedClass+aC failedClas+fC)] ++ addClassesToAllStd xs ys
  </code></pre>
  <p>But I don't know how to check if i'm adding to the right student? And I don't understand why this doesn't work (even without checking if i'm adding to the right studdent)?</p>
  <p>Here's an exempla how it's supposed to work:</p>
  <pre><code>&gt;french1 = addClassesToAllStd french [(&quot;Emma&quot;,5,1),
  (&quot;Max&quot;,3,3), (&quot;Carol&quot;,4,2)]
  &gt; carol = getStudent french1 &quot;Carol&quot;
  &gt; approvedClass carol
  4
  &gt; failedClass carol
  4
  &gt; max = getStudent french &quot;Max&quot;
  &gt; approvedClass max
  3
  &gt; failedClass max
  3
  </code></pre>
  <p>and french was <code>french =  [(&quot;Emma&quot;,0,0),(&quot;Max&quot;,0,0), (&quot;Carol&quot;,0,0)]</code></p>