title: Filtering Nothing and unpack Just
body: <p>I'm having trouble with this program.</p>
  
  <pre><code>filterJust :: [Maybe a] -&gt; [a]
  
  filterJust [] = []
  filterJust x = map fromJust (filter (isJust) x)
  </code></pre>
  
  <p>but ghci keeps reporting this</p>
  
  <p><a href="https://i.stack.imgur.com/scXox.png" rel="noreferrer"><img src="https://i.stack.imgur.com/scXox.png" alt="but ghci keeps reporting this"></a></p>
  
  <p>EDIT:</p>
  
  <p>I don't want to use any additional module so i made this:</p>
  
  <pre><code>filterJust :: [Maybe a] -&gt; [a]
  
  filterJust x = map unpack (filter (Nothing /=) x)
  
  unpack (Just a) = a
  </code></pre>
  
  <p>and i get this message</p>
  
  <p><a href="https://i.stack.imgur.com/ssOtg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ssOtg.png" alt="and i get this message"></a></p>
  
  <p>and i dont understand why. I should be able to use Eq functions without importing anthing right?</p>