[Haskell-cafe] automatically inserting type declarations

Claus Reinke claus.reinke at talk21.com
Tue Apr 7 05:08:39 EDT 2009


>I remember hearing about a Haskell mode for Vim, Emacs, Yi or
> VisualHaskell that inserts type declarations automatically (it's
> lazier to just check the type than to write it manually), but I can't
> remember any details. What editor mode / IDE was it?

As far as I know, my haskellmode plugins for Vim were the first
to do that, in their long-gone predecessor incarnation of hugs.vim.

But I'm pretty sure this feature was adopted by the Emacs folks
as soon as people started saying they liked it. That is, types for
top-level declarations - more precise types are on everyone's 
todo list, I think (by just doing what VisualHaskell used to do:
ask a dedicated GHC API client for details).

Take the identifier under cursor, run something like 

    ghc -e ":t <id>" <current_module>

and either show the result, or insert it. These days, the plugins no
longer call out to GHC every time, instead they update an internal
map whenever you use ':make' in quickfix mode and get no errors
from GHC. Anyway, the plugins have recently moved here:

http://projects.haskell.org/haskellmode-vim

> What do most people use with GHC on Linux? I'm more used to Vim than
> to Emacs. Yi sounds like something I might like. Is it stable enough
> to solve more problems than it would create? (I hate buggy and broken
> stuff)

haskellmode-vim isn't free of problems (mostly to do with large
numbers of installed libraries vs naive scripts). The reason it exists
is to solve problems I don't want to have, so it tends to improve
whenever a problem bugs me enough, but whether the result works
for you, you have to try for yourself!-)

Claus



More information about the Haskell-Cafe mailing list