4 ms·
> The Haskellite approach would also say that "what operations are available on that thing" is the wrong way round; you define your operation, and the type sign
by seanmcdirmid 7y ago
> The Haskellite approach would also say that "what operations are available on that thing" is the wrong way round; you define your operation, and the type signature tells you what kind of things will work with it.
How does code completion work in Haskell IDEs then? It doesn’t seem that it would have a decent anchor.
- marcosdumay 7y agoTL/DR, completing MyClass.someAction is not very different from myClass_someAction. Outside of the C++/Java/.Net world, names tend to be much smaller. Anyway, it works like autocompletion works on any textual input, a couple of characters severely restrict the amount of words you are trying to write, and context guides on the rest. Haskell in particular tends to exhibit local variables that are less than a couple of characters long, so autocomplete does not even make sense for those. Globals tend to have wither short distinctive names when they are more generic, or long prefixed names when they are concrete. Either way, just completing over a dictionary gets results that are at least as good as you'll get on Java/.Net/C++ IDEs. Haskell also brings a lot of added context, but I don't know of any IDE that uses those for completion (and honestly, I don't miss it).
- seanmcdirmid 7y ago> Outside of the C++/Java/.Net world, names tend to be much smaller. That has little to do with code completion, which is more about API discovery than saving on typing. It seems like many Haskell enthusiasts never figured that out, so they didn’t bother with it in tool development. Which is funny, given with all that extra strong typing, they might be able to come up with an experience that is much better than the other languages, but I guess not yet.
- rossng 7y agoHoogle is pretty nice, and few other languages had an equivalent until quite recently. I'm hopeful that cool type-powered IDE features will start to arrive once haskell-ide-engine is a bit more stable. It's getting there! There are some pretty awesome IDE ideas in Haskell-ish languages like Idris [1], too. There is some movement towards dependent types in Haskell, so it might get similar features one day. [1] https://www.youtube.com/watch?v=mOtKD7ml0NU https://www.youtube.com/watch?v=mOtKD7ml0NU
- pcstl 7y agoWell, we have Intero (https://haskell-lang.org/intero https://haskell-lang.org/intero) now.
- lilactown 7y agoI haven't used Haskell, but in OCaml things tend to be organized in modules related to the particular type, which allows you to get autocomplete like: List. | length | hd | tl ...
- dpratt71 7y agoThis is a sad reminder to me that the tooling story around Haskell seems to be perpetually almost really good. Case in point, the core toolchain (e.g. the compiler itself) supports "typed holes". Basically, you drop a placeholder somewhere in an expression and the compiler will infer and report the type of the sub-expression. There are also tools to search either within a program/library or e.g. the entirety of the Hackage package database for functions matching a certain type. It seems like a relatively short distance from there to having an IDE or code editor that can list possible expressions/functions that could satisfy a particular placeholder. And to me, having e.g. a list functions that transforms the input(s) I have to the output I need seems much better than e.g. a partial list of all the functions that relate to a particular type. And maybe such a thing exists today, but I have had really bad luck trying to get Haskell tooling that works well and is easy to set up.