title: Automatically add type signatures to top-level functions
body: <p>I was lazy and wrote a Haskell module (using the excellent EclipseFP IDE) without giving type signatures to my top-level functions.</p>
  
  <p>EclipseFP uses HLint to automatically label every offending function, and I can fix each one with 4 mouse clicks. Effective, but tedious.</p>
  
  <p><strong>Is there a utility program that will scan a .hs file, and emit a modified version that adds type signatures to each top-level function?</strong></p>
  
  <p>Example:</p>
  
  <pre><code>./addTypeSignatures Foo.hs 
  </code></pre>
  
  <p>would read a file <code>Foo.hs</code>:</p>
  
  <pre><code>foo x = foo + a
  </code></pre>
  
  <p>and emit</p>
  
  <pre><code>foo :: Num a =&gt; a -&gt; a
  foo x = x + 1
  </code></pre>
  
  <p>Bonus points if the tool automatically edits <code>Foo.hs</code> in place and saves a backup <code>Foo.bak.hs</code></p>