3 ms·
I've only dabbled with GHCI. I've used it as a standalone REPL for trying out small things, the same way I'd use a Python or Javascript REPL. I haven't used the
by teodorlu 6y ago
I've only dabbled with GHCI. I've used it as a standalone REPL for trying out small things, the same way I'd use a Python or Javascript REPL. I haven't used the REPL /the/ developer interface to the program. In Clojure, I would (1) start a REPL server, (2) connect to it from my editor, and (3) send expressions to it. I didn't develop Haskell that way, though I think it was possible with Intero[1].
Within the Clojure community, there's a perception that the Clojure REPL is one of its strongest selling points[2].
Are you using the REPL actively when developing?
Edit: really curious about the "-- >>> expression " syntax! I might have to give Haskell another go.
Edit 2: Example of this interaction in practice with VSCode[3]
[1]: https://github.com/chrisdone/intero#readme https://github.com/chrisdone/intero#readme
[2]: https://clojure.org/guides/repl/introduction https://clojure.org/guides/repl/introduction
[3]: https://github.com/haskell/haskell-language-server#features https://github.com/haskell/haskell-language-server#features
- marcosdumay 6y agoI program in Haskell much more than in any Lisp. But AFAIK, GHCi doesn't have any state saving functionality (I don't think the dev environment is even integrated enough for any to work), and the little code edition available is entire function only. The Haskell REPL is entirely oriented into the "you write the code on the editor -> you evaluate it on the REPL" way (again, AFAIK, the GHCi manual is huge). That said, yes, it's a really seamless cycle of you write your code on the editor -> you evaluate it on the REPL, and yes, Haskell requires doing that very little, most problems stop at the type checker. Haskell does really not afford interactive programming, but I wouldn't classify that as a problem.
- remexre 6y agoThis is definitely weaker than a SLIME-like REPL, but I use ghcid --warnings --test My.Module.Tests.runTest, where runTest is tasty's defaultMain, to get near-instantaneous test running on changes to files. (Since it's GHCi instead of GHC, waiting for a full compile is unnecessary, and it still has the necessary smarts about what needs reloading to avoid reloading the whole project every change.)
- d2v 6y agoHave you tried out ghcid? It basically just runs ghci on your program every time you save, and gives an updated list of errors and warnings. Not interactive in the sense that you don't manually test your functions with it, but like 95% of debugging in Haskell is just fixing errors at compilation time. I find it to be a very nice developer experience. Just need a text editor and a terminal with ghcid open and you get immediate feedback as you program. https://github.com/ndmitchell/ghcid https://github.com/ndmitchell/ghcid
- teodorlu 6y agoHaven't heard of it before, but this looks super interesting! Thanks for the recommendation. I really like the fact that my whole development workflow could be a text editor and a terminal. I enjoyed developing Elm with TCR[1] a while back; also with an editor + a type checker (plus the revert part). I recompiled my whole source on each save; incremental recompilation should scale better. [1]: https://medium.com/@kentbeck_7670/test-commit-revert-870bbd756864 https://medium.com/@kentbeck_7670/test-commit-revert-870bbd7...