title: How do I do String replace in Haskell
body: <p>So I have the following list of tuples and a string</p>
  
  <pre>
  <code>
  type M a = [(String, String)]
  m = [
      ("x", "a car"),
      ("y", "a animal")
  ]
  s = "this is x and y"
  </code>
  </pre>
  
  <p>I am trying to</p>
  
  <p><code>strRep m s</code> => "this is a car and a animal"</p>
  
  <p>So this is my attempt so far</p>
  
  <pre>
  <code>
  import Data.List.Utils
  
  strRep :: (Show a) => M -> String -> String
  strRep [] s = s
  strRep (m:ms) s = replace (fst m) (snd m) s : strRep ms s
  </code>
  </pre>
  
  <p>The above code returns a list of string.  I cant quite figure out the proper way to do loop here.</p>