Hacker News new | comments | ask | show | jobs | submit login

> You might later find that something that took you 5 lines is a standard abstraction ready to be re-used.

Such a great point and perhaps one of the biggest challenges as languages allow increasingly reusable and powerful abstractions. I would love to have GHC tell me something like "this piece of code here has a signature that is familiar, you could probably make this fit into {list of abstractions}".




If you're interested in a tool like that, check out Hoogle: https://www.haskell.org/hoogle/. It allows you to search by signature, including using generic types (e.g. their front page example is (a -> b) -> [a] -> [b], which will return map as a result, among others).


That doesn't seem like something a compiler should care about, I think it would be better to add it to something like hlint.


Djinn: https://hackage.haskell.org/package/djinn

Does more or less what you described.


Such a tool exists. I've had hlint tell me many times how to do something in a better way. At some point I had it hooked into my IDE, so it would mark improvable code in yellow.

Especially in the first year I learned a lot of new Haskell syntax and functions just from its suggestions.


If you don't mind me asking, which IDE do you use?


Oh, yeah, I should have mentioned that: IntelliJ IDEA with the Haskforce plugin. The plugin isn't maintained any longer, though, so it's not the best solution, but it was perfect when both ghc-mod and hlint worked. ghc-mod still works, because I can't go back to coding without it, speeds everything up so much to have instant compiler feedback.

For example, there is this fatal, unresolved bug that no one knows how to fix: https://github.com/carymrobbins/intellij-haskforce/issues/28...

EDIT: It's working again (for projects that do not exhibit above bug): http://i.imgur.com/jPo4Tas.png


Intero is amazing for this.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: