eagletmt / ghcmod-vim

Happy Haskell programming on Vim, powered by ghc-mod
http://www.vim.org/scripts/script.php?script_id=4473
433 stars 59 forks source link

Typeclass information missing when using :GhcModType and :GhcModTypeInsert #89

Open SageEx opened 8 years ago

SageEx commented 8 years ago

Is there an option to see the class constraints in the function definition ? Like:

compress [] = []
compress [a] = [a]
compress (a:b:xs)
    | a==b = compress (a:xs)
    | otherwise = a: compress (b:xs)

On :GhcModTypeInsert it shows compress :: [a] -> [a] however, it should be compress :: Eq a => [a] -> [a]. This lack of typeclass information is wrong - ghci refuses to accept the file (as it should). So, is there an configuration option that I overlooked ? If not, shouldn't this be the default behaviour ?

DanielG commented 8 years ago

That's a bug upstream in ghc-mod caused by a change of behavior in GHC (I think). We have a partial fix available but I haven't come around to testing and cleaning it up yet. Even just finding out which version of GHC introduced this problem or if it is a problem in ghc-mod after all would already be a big help BTW.

SageEx commented 8 years ago

I checked out vim-hdevtools today. It also uses the latest ghc-7.10.3 on my system. The info function works fine with hdevtools - it shows proper typeclass constraints for the functions along with the type. I think this bug is in ghc-mod not ghc itself, since hdevtools works fine. On the project page, it says it shares some code with ghc-mod itself. This might help.