atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Temporary workaround for ghc-mod type missing type class info. #98

Closed jacksonja closed 8 years ago

jacksonja commented 8 years ago

This is a hack to allow insert type to insert proper type class info with versions of ghc-mod that have a bug when using the 'type' command. Not sure if you are interested in putting hacks into the code base but I thought I'd throw it out for your review. Feel free to ignore.

lierdakil commented 8 years ago

There are a couple problems with this approach, that I can think of from the top of my head:

1) info doesn't work for symbols that are not exported 2) in cases of overlap, especially in let and where expressions, wrong type will be inserted.

I'm fine with hacks, for the most part. If they work, that is. So, long story short, if I'm to merge this, I'd first politely request that you think about fallback mechanics and corner cases.

Also would be nice if you could tell which versions of ghc-mod are affected, so that we could use this hack only when necessary. Honestly, I'm not really sure of when this became an issue in the first place.

jacksonja commented 8 years ago

I'm fairly new to Haskell and ghc-mod so I wasn't aware of these shortcomings. I'd say probably just get rid of this pull request. Hopefully they'll eventually fix it upstream.

lierdakil commented 8 years ago

Just an FYI, "they" also includes me now, apparently. But getting polymorphic type is not as easy as one would imagine, regrettably. Well, we'll see if we can figure something out. Probably will take some time though.

lierdakil commented 8 years ago

FWIW, I started working on this in https://github.com/DanielG/ghc-mod/pull/731. Provided everything goes smoothly, ghc-mod 5.6.0.0 will probably include this.