4 ms·
Haskell and ML languages look like symbol soup when you're used to mainstream/C style languages. Once you understand some of the basic syntax they become quite
by lpage 7y ago
Haskell and ML languages look like symbol soup when you're used to mainstream/C style languages. Once you understand some of the basic syntax they become quite readable and easy to reason about as a series of transformations.
Step one, which applies to most functional languages, is knowing how to read a Hindley-Milner type signature [1].
Armed with that you can often gain a surface level understanding of what some function does - and what the program does in aggregate - just by reading type signatures and seeing what calls what.
Hoogle [2] is a good resource for figuring out Haskell syntax, like what's up with all of those $ signs.
Converting OCaml to ReasonML syntax with sketch or reason-tools [3] makes OCaml less foreign.
With basic knowledge of Haskell and ML syntax you'll find many FP languages readable.
[1] https://drboolean.gitbooks.io/mostly-adequate-guide-old/content/ch7.html#tales-from-the-cryptic https://drboolean.gitbooks.io/mostly-adequate-guide-old/cont...
[2] https://hoogle.haskell.org/ https://hoogle.haskell.org/
[3] https://reasonml.github.io/docs/en/extra-goodies https://reasonml.github.io/docs/en/extra-goodies
- jakear 7y ago“Quite readable” is a stretch... I know of no other language that needs a hoogle equivalent. That being said, my experience with Haskell is limited to working on some meta-meta-programming research in college, where every file used at minimum 3 different GHC extensions. So I may be biased.
- mlevental 7y ago>at minimum 3 different GHC extensions. So I may be biased. are you kidding? most files i see have all of these http://dev.stephendiehl.com/hask/#the-benign http://dev.stephendiehl.com/hask/#the-benign
- jakear 7y agoAgain, I don’t have a clue what I’m talking about. But I seem to remember seeing a lot of those “dangerous” ones. If that’s just the state of Haskell, my bad.
- whateveracct 7y agoYou don't need hoogle -.- It is a very cool tool tho
- FridgeSeal 7y agoI find Haskell less of a “needs” a hoogle, and more of a “nothing else has this, this is so useful”. The number of times I have wished for something like Hoogle when writing Python...
- SomeOldThrow 7y agoScala could definitely use hoogle, as can c++/boost. My lesson from all this is to never ever overload an operator except, maybe, the comparison operators. Exception: apl.
- seer 7y agoThank you so much for the reference to “mostly adequate guide to FP” book. It looks incredibly easy to read. As someone who is fluent in JS and dabbled in FP this is right down my alley, and the style of text itself is actually quite funny and conversational - I love that. I’ve noticed that a _a lot of_ stuff written about FP tries to emulate this fun and easy going style - I wonder why that is. I still refer to clojure’s “re-frame” docs as the epitome of technical literature - a text so good you can read it in its own right just for the fun of it. I don’t want to diminish other languages’ communities of course, as this is totally anecdotal. I’ve found awesome prose in other places as well (mostly ruby/python) but I just encounter those funny gems more often reading about FP.