title: Removing duplicates from a list in Haskell without elem
body: <p>I'm trying to define a function which will remove duplicates from a list. So far I have a working implementation:</p>
  
  <pre><code>rmdups :: Eq a =&gt; [a] -&gt; [a]
  rmdups [] = []
  rmdups (x:xs)   | x `elem` xs   = rmdups xs
                  | otherwise     = x : rmdups xs
  </code></pre>
  
  <p>However I'd like to rework this without using <code>elem</code>. What would be the best method for this?</p>
  
  <p>I'd like to do this using my own function and not <code>nub</code> or <code>nubBy</code>.</p>