4 ms·
Part of the trouble with Haskell is the prevalence of syntactic sugar. It is incredibly easy to make code that is tiny and indecipherable because it relies upon
by SaxonRobber 7y ago
Part of the trouble with Haskell is the prevalence of syntactic sugar. It is incredibly easy to make code that is tiny and indecipherable because it relies upon functions which are compositions of higher-ordered functions with monads and obscure operators that no other language has. And on top of that Haskell is lazily evaluated, which complicates it further.
And don’t even start with point-free style, a style where parameters are left implicit. For a reader point-free is appalling and way too clever.
I would say junior Haskell should be unsophisticated. Leave out the higher order abstractions and write longer code which a reader at a lower level has a hope of deciphering.
- monoideism 7y ago> For a reader point-free is appalling and way too clever. I used to believe this, but as I started to read more and more Haskell, I realized that I just had to get used to that style of writing Haskell. I now read it fine, in general. Learning to read point-free is a learnable skill. Tons of non standard sigils, on the other hand, is a bane.
- millstone 7y agoThere's definitely a vein of deliberate unreadability. Types and parameters are often labelled positionally instead of given meaningful names. For example the graph library fgl uses typenames 'a' and 'b' instead of useful names like 'NodeLabel' and 'EdgeLabel'.
- monoideism 7y agoOK, those are poor stylistic practices, but they’re orthogonal to point-free style.
- edflsafoiewq 7y agoIt is related. In point-free style the "omitted" parameters have to be distinguished positionally; they have no names at all, not even 'a' or 'b'.
- nmca 7y ago^^^^^ This is extremely insightful, and now ranks as the most accurate and succinct explanation I've seen of why point-free is terrible.
- monoideism 7y agoIt's not extremely insightful. It's literally the definition of point-free style. Also, Haskell doesn't have labeled/keyword function parameters, regardless of whether or not you use point-free style. Sometimes, people pass in a record to achieve a similar effect, but in general, passing in a ton of parameters goes against idiomatic Haskell style.
- monoideism 7y ago> In point-free style the "omitted" parameters have to be distinguished positionally; they have no names at all, not even 'a' or 'b Yes, that's literally the definition of point-free style. I was referring to labeling function parameters `a` and `b`. Also, when I checked, that's actually not what the FGL library does. It labels type parameters with `a` and `b`. Labeling generics and type parameters with letters of the alphabet is pretty typical for a wide range of languages (ie, `T` in Java, etc.). Arguably, it's a bad idea, but it's by no means unique to Haskell.
- 3fe9a03ccd14ca5 7y ago> I realized that I just had to get used to that style of writing Haskell. I now read it fine, in general. The question of course is how true is this for the general engineering community? Reminds me in some ways of survivor bias: those that stick successfully with Haskell tend to see the shortcomings perhaps as virtues.
- monoideism 7y agoI don’t think Haskell will ever be a language used by the general software development community. For the record, my primary languages now is OCaml (and to a much lesser extent, functional Scala). But I like reading Haskell code. There are a lot of good ideas there (and no, my Scala/OCaml isn’t loaded down with custom sigils).
- crimsonalucard 7y agoI think it's true in general. Point free style is just different from other programming styles it's not particularly unreadable. Haskell definitely has issues, but I agree with the parent on his opinion on point free style.