title: Haskell function that tests if a list has repeated (duplicate) elements
body: <p>I have an exercise to do, however and since I'm new to the language, I can not find any way on how to do it.</p>
  
  <p>I have this function "repeated" that's defined as such, given under this paragraph. It receives a list of Int and gives back a Bool value. It's supposed to check if a list has any repeated elements. If so, it's TRUE, if not, it's false. There is one extra: I have to define the function by recursion, so it has to be a recursive function. Would appreciate any help.</p>
  
  <pre><code>repeated :: [Int] -&gt; Bool
  </code></pre>
  
  <p>EDIT1: So far, I've only managed to succeed with this amount of code</p>
  
  <pre><code>repeated :: [Int] -&gt; Bool
  repeated [] = False
  repeated (h:t) = 
  </code></pre>
  
  <p>Which gives me back the empty list, only. The rest, I've not been able to figure out so far...</p>
  
  <p>EDIT2: Forgot about the singular lists... Also, possible answer?</p>
  
  <pre><code>repeated :: [Int] -&gt; Bool
  repeated [] = False
  repeated [_] = False
  repeated (h:t) = if elem h t then True
                               else repeated t
  </code></pre>
  
  <p>That's pretty much it. I've compiled the .hs and it worked perfectly. Thank you all for the suggestions and hints! :)</p>