I was lazy and wrote a Haskell module (using the excellent EclipseFP IDE) without giving type signatures to my top-level functions.
EclipseFP uses HLint to automatically label every offending function, and I can fix each one with 4 mouse clicks. Effective, but tedious.
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?
Example:
./addTypeSignatures Foo.hs
would read a file Foo.hs:
foo x = foo + a
and emit
foo :: Num a => a -> a
foo x = x + 1
Bonus points if the tool automatically edits Foo.hs in place and saves a backup Foo.bak.hs
There's haskell-mode for emacs that has a shortcut to insert type signature of a function: C-u, C-c, C-t. It is not automatic, you have to do it for each function. But if you have only one module, it will probably take you a few minutes to go through it.