title: Using a function twice using map
body: <p>I want a function used twice on a String. I'm gonna explain what i want so I hope at the end of the question you get what i mean.</p>
  
  <p>So i have this function.</p>
  
  <pre><code>foo :: String -&gt; [String]
  foo = ...
  </code></pre>
  
  <p>Now i want that this function is used twice on a String. So when used first it should run foo with the String that is given to the function and on the second run it should used on every String from the [String] that is produced by the first run. So i guessed that map is the best function to do that.
  So i got this function now</p>
  
  <pre><code>f :: String -&gt; [String]
  f w = map foo (foo w)
  </code></pre>
  
  <p>But the compliler gives me this error:</p>
  
  <pre><code>MyHaskell.hs:86:19:
  Couldn't match type `[Char]' with `Char'
  Expected type: String -&gt; String
    Actual type: String -&gt; [String]
  In the first argument of `map', namely `edits1'
  In the expression: map edits1 (edits1 word)
  </code></pre>
  
  <p>I guess the problem is that my function foo (String -> [String]) does not work out with map ((a->b) -> [a] -> [b]).</p>
  
  <p>How do i fix that?</p>