title: Is there a better way to write a "string contains X" method?
body: <p>Just stared using Haskell and realized (at far as I can tell) there is no direct way to check a string to see if it contains a smaller string.  So I figured I'd just take a shot at it.</p>
  
  <p>Essentially the idea was to check if the two strings were the same size and were equal.  If the string being checked was longer, recursively lop of the head and run the check again until the string being checked was the same length.</p>
  
  <p>The rest of the possibilities I used pattern matching to handle them.  This is what I came up with:</p>
  
  <pre><code>stringExists "" wordToCheckAgainst = False
  stringExists wordToCheckFor "" = False
  stringExists wordToCheckFor wordToCheckAgainst | length wordToCheckAgainst &lt; length wordToCheckFor = False
                                                 | length wordToCheckAgainst == length wordToCheckFor = wordToCheckAgainst == wordToCheckFor
                                                 | take (length wordToCheckFor) wordToCheckAgainst == wordToCheckFor = True
                                                 | otherwise = stringExists wordToCheckFor (tail wordToCheckAgainst)
  </code></pre>