6 ms·
As somebody who has only recently started looking into functional programming, this was absolutely fascinating. Even though I'm not very familiar with Haskell,
by wldlyinaccurate 12y ago
As somebody who has only recently started looking into functional programming, this was absolutely fascinating.
Even though I'm not very familiar with Haskell, I find this code much more concise and easy to follow compared to the original git-clone implementation in C. Though perhaps that's more down to the author's coding style?
- hashtree 12y agoAs to your question, I think it is both. The author's ability to walk you through his thought processes in a clear and concise manner, his general strength as a writer, the fact that he added diagrams and models to help the reader, and that this did not seem to be written only for Haskellers to read... well they all add up to what you are describe. Kudos to the author.
- spopejoy 12y agoI'm having an interesting experience with this at my job ... Haskell appears to be MUCH more approachable when you understand the problem at hand. So much Haskell pedagogy wants you to write a compiler or a parser or ... whereas this article is taking you through a solution. And whaddyaknow -- Haskell comes across as gorgeous, elegant, compact, and highly comprehensible. When I show a FIX server or REST API written in Haskell to a non-Haskeller coworker (ie everyone else :) ), with minimal explanation they're getting what's going on. I look forward to many more "Haskell-in-anger" articles to show the world how fantastic it is to work with.
- eru 12y agoYes. Haskellers are just too much in love with compilers and parsers. Those are much easier to write in Haskell, but not enough people have grappled, and suffered (and failed) to write one in eg C to appreciate.
- stefans 12y agoAuthor here. Thanks for the kind comment, happy to see that other people and not just myself got something out of this exercise.
- wyager 12y agoIn my experience, pure functional programming, combined with Haskell's relatively permissive syntax, allows for very natural-language-like and well-structured programs. Languages like Agda can do this even more impressively. You can do stuff like write if_then_else_ : Bool -> a -> a -> a And you can split up the "if", "then", and "else" and put the arguments where the underscores are.
- taeric 12y agoMeh. I think it is arguable that the code from this article is as easy as it is to understand as much from the prose that goes with it as from the language it is written in. My argument would actually lean towards more so.
- Dewie 12y ago> I think it is arguable that the code from this article is as easy as it is to understand as much from the prose that goes with it as from the language it is written in. This was hard to understand.
- taeric 12y agoApologies. I think I should have just written that in multiple sentences. I don't think mere commas can save it. Simply put, my assertion is that it is the accompanying prose and diagrams that truly make the code easy to understand. Not its implementation language. I would love to say that my terrible sentence above illustrates that prose is not a panacea. Well, I think I can claim that. I can not claim it was intentional. :)
- pmoriarty 12y agoFor what it's worth, I found your original statement perfectly clear.
- eru 12y ago> Simply put, my assertion is that it is the accompanying prose and diagrams that truly make the code easy to understand. Not its implementation language. Haskell does help somewhat, in that it's offers you a lot of flexibility in how to structure your program. So you can tailor your program to your explanation. (Knuth's literate programming tools help bring those capabilities and more to more conventional languages.)