title: List of prefixes in haskell
body: <p>I am to write a function which returns a list of all prefixes of a given string.</p>
  
  <p>This is where I'm at so far. </p>
  
  <pre><code>prefixess [x] [] = [x]
  prefixess [] s = prefixess [s] s
  prefixess [x] s  = prefixess [x, (init s)] (init s)
  prefixes s = prefixess [] s
  </code></pre>
  
  <p>It compiles, but when I try running it on a string I get this:</p>
  
  <pre><code>Couldn't match type ‘Char’ with ‘[t]’
  Expected type: [[t]]
    Actual type: [Char]
  Relevant bindings include
    it :: [t] -&gt; [[t]] (bound at &lt;interactive&gt;:18:1)
  In the first argument of ‘prefixess’, namely ‘"abcde"’
  In the expression: prefixess "abcde"
  In an equation for ‘it’: it = prefixess "abcde"
  </code></pre>
  
  <p>I am out of ideas. Any hints?</p>