10 ms·
> Haskell is great for business and great in production. Hot take: no it isn't. It is extremely hard to learn, has an extremely confusing + needlessly complica
by MuffinFlavored 7y ago
> Haskell is great for business and great in production.
Hot take: no it isn't. It is extremely hard to learn, has an extremely confusing + needlessly complicated syntax and I question the payoff immensely. I question the well-being of anybody who subjects themselves to the pain and torture that is Haskell.
If I stood up in a corporate business boardroom meeting for tech analysis on a new project and said "I want to write it in Haskell", I'd get laughed + kicked out.
- rifung 7y ago> It is extremely hard to learn, has an extremely confusing + needlessly complicated syntax and I agree with your other points but what's wrong with the syntax? I actually really like the syntax for the most part
- epsolos 7y agoMost people that have worked as developers/programmers/etc. that don't have a lot of exposure to or training in fp find it painfully hard to learn. This could be one of those cases.
- brokencode 7y agoTo them, I would suggest that they remember back to when they learned their first imperative language like Java or C. For me, that was really difficult to wrap my mind around at the time, but now those languages are second nature to me. I kind of suspect that if everyone were exposed to a functional language first, there would be a lot fewer people who think they are extremely hard to learn.
- journalctl 7y agoI fondly remember being confused by “return” for weeks (granted, I was 9). What are you returning? And to where? And why was it only one thing? And where did it go when it got there? It’s easy to forget how hard something was to learn once you already know it.
- cuddlecake 7y agoI remember when I started with Java at University. Like, "hello, what is a method? What the hell is a class? Come on, stop kidding me, objects have methods???? How do I call them? Wait, how do I _write_ a method?"
- shantly 7y agoWhat I kept bouncing off of was all the stupid as shit "sally sends a BUY message to Tommy's bagel shop" crap. I just needed about two to four pages worth of text & diagrams demonstrating how objects and structs are pretty much the same thing, and what the OO sugar inheritance and keywords and dynamic dispatch and such do under the hood, which ain't that complicated. Every single book I picked up (back in the '90s, when if you didn't know someone to personally recommend a book it was much harder to figure out which ones were decent and which sucked) wanted to use those awful, cutesy analogies to introduce OO and they just confused the hell out of me, and convinced me something dead-simple was hard.
- sullyj3 7y agoThere are many reasons Haskell is difficult to learn, and the functional programming aspects are only part of it. I'd venture a guess that it's vastly easier to go from say, python to clojure, than from python to haskell. Even neglecting clojure's impure escape hatches.
- mbrodersen 7y agoIf you are learning something new and it isn't hard to learn then you are not learning anything truly new. Just variations/flavours of what you already know. If it is really hard then you are truly learning something new. No pain no gain.
- fnord123 7y ago++ >> >>> >>= `concat` .
- Barrin92 7y agoI'm not the OP but I would agree and my problem with the syntax is the number of symbols that don't make the semantics clear at all. The Lens library for example, but also a lot of standard stuff like the bind operator, it's extremely complex. Many people also seem to go overboard on the dot notation which can be very hard to read.
- olah_1 7y ago>but what's wrong with the syntax? I'll just link to this blog about readable Haskell. If everyone followed his advise, it would be much better. http://www.haskellforall.com/2015/09/how-to-make-your-haskell-code-more.html http://www.haskellforall.com/2015/09/how-to-make-your-haskel...
- brianberns 7y agoThanks. That's a good blog. The $ operator is definitely confusing in Haskell. F# uses <| to indicate a backward pipe, which I find much more intuitive. For example: print <| even <| 4 * 2 This means: Take the result of 4 * 2 and send it to `even`, then take that result and send it to `print`. Or you can write it with forward pipes to make it even clearer: 4 * 2 |> even |> print The thing about backward pipes is that they're often used to avoid parentheses, which is IMHO a good idea. It's just that thinking of them as "function application" is confusing. F#'s operators makes the data flow clear. [Side note: The mathematical symbol for function composition is the circle operator, ∘, which is also confusing for the same reason. Does (g ∘ f)(x) mean g(f(x)) or f(g(x))? Personally, I can never remember. If math used F#'s >> and << composition operators instead, there'd be no doubt that f >> g sends the output of f to g, so (f >> g)(x) means g(f(x)).]
- ghkbrew 7y ago> The $ operator is definitely confusing in Haskell I generally think of it as a sort of open-ended parentheses that encloses the rest of the line. Instead of a backward pipe. It means "evaluate everything after this character first then apply the preceding function to it" just like parentheses would. print $ even $ 4 * 2 is equivalent to print ( even ( 4 * 2 ))
- brianberns 7y agoYou're right, and that's why it's usually called "function application" instead of "backward pipe". However, using $ as an operator is confusing because the associativity is ambiguous if you're not already comfortable with it.
- ratww 7y agoI've been using Haskell on and off for almost ten years, and the "front end" of the language, including its syntax, is pretty much the only thing that I absolutely hate about it. The endless operators, all the language extensions required in 2019, the madness called Template Haskell, the absurdity of point free style, the multiple ways of achieving things by cleverly using . and $, the uncanny valley of do-notation (why does it look different? F# gets it right). It's too easy to be clever. It's too easy to take shortcuts that the next person won't understand. I'm completely fine with the underlying semantics! Lazy evaluation, the majestic typechecker, concepts like monads, functors, lenses. Even when it comes to syntax, I love how functions are declared, the way parenthesis work, currying, all the "simple stuff". I adore all those concepts and apply them to other languages. I long for a Haskell-like language without the stuff I mentioned above. I think the problem is that in Haskell everything feels like an afterthought, everything feels "bolt on" rather than "built in". 99% of the hot stuff is implemented using libraries. That's similar to Lisp and C++, other languages I hate (I also love Lisp parens, but I hate macros). Now that I think about it, I prefer less extensible languages that require adding code to the compiler to extend it: C#, F#, Go, JavaScript.
- thesz 7y agoIf you can have better solution to the problem at hand with the library, you will solve it faster. Turnaround time for library is much less than for a compiler. So if language provides a way to solve something with a library instead of compiler, it provides a way for faster path to solution.
- excursionist 7y agoHaskell syntax is great except for the indentation/layout rules. There is no simple definition of the grammar with regards to the layout. It's only specified as a headache-inducting operation of a state machine [1], and the implementation is quite hard to read. This is fine for writing Haskell, but quite painful if you want to parse it. [1]https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3 https://www.haskell.org/onlinereport/haskell2010/haskellch10...
- brokencode 7y agoAre you speaking from experience? The article is about the author’s experience from a year of using Haskell. I don’t think it’s fair or constructive to disagree with his findings unless you also have experience using the language, and it doesn’t sound like that is the case.
- microtherion 7y agoSo if somebody asserted that INTERCAL-72 is the proper language to use for production code, you would consider it unfair to contradict them until you've used INTERCAL in production code yourself? Personally, I would not necessarily disbelieve somewhat propagating Haskell as a production ready language. However, I'm fairly confident that it would be thoroughly unsuited to any areas of work I regularly operate in. I have tried a number of times to learn Haskell (from a variety of tutorials and text books). I find myself nodding along sympathetically at the fundamentals (functional purity, non-strict evaluation). I can follow the initial chapters. And somewhere between "Functor" and "Applicative", I tend to lose the plot. Then I look at supposedly real world code like the URL shortener in Allen/Moronuki's "Haskell Programming from First Principles", and I just can't make heads or tails of it: https://github.com/bitemyapp/shawty-prime/blob/master/app/Main.hs https://github.com/bitemyapp/shawty-prime/blob/master/app/Ma... app :: R.Connection -> ScottyM () app rConn = do get "/" $ do uri <- param "uri" let parsedUri :: Maybe URI parsedUri = parseURI (TL.unpack uri) case parsedUri of Just _ -> do shawty <- liftIO shortyGen let shorty = BC.pack shawty uri' = encodeUtf8 (TL.toStrict uri) resp <- liftIO (saveURI rConn shorty uri') html (shortyCreated resp shawty) Nothing -> text (shortyAintUri uri) If that's supposed to be the way to write production code in the future, count me out!
- whateveracct 7y agoWhat exactly is wrong with it? I've never even used the Scotty library or monad being used and I can understand it.
- microtherion 7y ago
- madhadron 7y ago> Hot take: no it isn't. Odd. I did some Haskell in prodution (hardware control and Unix daemons) and it was delightful. > It is extremely hard to learn, has an extremely confusing + needlessly complicated syntax and I question the payoff immensely. It is unfamiliar if you have only worked in the C family of languages. The syntax is quite similar to the rest of the ML family, which dates back to 1973. It's basically as old as C. I had the good fortunate of learning Standard ML around the same time as C, SQL, and Perl. Standard ML and SQL were by far the most straightforward to learn. > If I stood up in a corporate business boardroom meeting for tech analysis on a new project and said "I want to write it in Haskell", I'd get laughed + kicked out. Yes, you would, because why are you talking about programming languages in a boardroom? If you mean a more technical review committee, I wouldn't be so sure of that.
- non-entity 7y ago> The syntax is quite similar to the rest of the ML family, which dates back to 1973. How close is it to say something Like F# then? I've toyed with F# a bit and was able to pick it up pretty decently, but a lot of Haskell still looks foreign to me
- nightski 7y agoIf you know F# you are going to feel a lot more comfortable than coming from say C/C++/C#. The largest difference imo between F#/Ocaml and Haskell is the evaluation model where Haskell is lazy by default.
- runeks 7y agoIMHO the largest difference is purity. Not being able to mix IO and non-IO functions like this print “Enter name:” print (“Hello “ ++ readStdinLine ++ “!”) in Haskell means you have to learn a new way of writing IO code.
- nightski 7y agoNot really. You can mix them in Haskell too. Think of F# as Haskell except you are always working in the IO monad. Haskell doesn't require a "new way of writing IO code" at all. It just allows you to separate out the IO from the pure in a way that can be enforced by the compiler. But there is nothing preventing you from writing all Haskell code in the IO monad if you were so inclined - which is essentially OCaml/F#.
- leshow 7y agoThat's a really strong opinion to present with absolutely no evidence.
- foopdoopfoop 7y agoSounds like you've barely programmed in Haskell and don't know what you're talking about. > It is extremely hard to learn Haskell was the first language I learned. I didn't think this at all and I still don't. It doesn't strike me as any more difficult than learning Java or something. You may think this because Haskell is a different paradigm than what you're used to, so while you may be able to get quickly started with Rust coming from a C++ background, Haskell will take more work because what you already know doesn't intersect with what you need to know quite as well. You may misconstrue this mismatch as Haskell being more difficult to learn. > extremely confusing + needlessly complicated syntax I think Haskell syntax is less confusing/complicated than many other language. Unlike a lot of other languages, Haskell doesn't have a lot of things baked-in. As an example, lot of oft-used functions are "user-space" functions that anyone could define themselves. Like `($)` or `otherwise`. > If I stood up in a corporate business boardroom meeting for tech analysis on a new project and said "I want to write it in Haskell", I'd get laughed + kicked out. This is such a stupid argument: what relevance is the opinion of boardroom meeting attendees on the suitability of Haskell for a project? It sounds like you're hating on Haskell out of ignorance and some personal encounter with the language that went poorly. Instead of actually being informed.
- MuffinFlavored 7y ago> Sounds like you've barely programmed in Haskell and don't know what you're talking about. You're right. I do not subject myself to Haskell because I can't fathom a world where JavaScript is less efficient than Haskell.
- tempguy9999 7y agoThen keep quiet. I agree completely with @foopdoopfoop.
- dang 7y agoYou can't do this here. We've had to ask you several times to follow the site guidelines. Would you please review https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and take the spirit of this site more to heart? Note the most important one: "Be kind." That doesn't vary depending on how annoying or wrong other comments are.
- tmpz 7y ago"Complicated" and "weird syntax" are pretty subjective measures to define how good a programming language is. C++ is weird and complicated to me.
- thesz 7y agoOne of my colleagues was tasked (by me) to extend microcontroller model for new controllers, including new commands, different bus widths, etc. Models was written in Haskell and parametrized by different widths - program counter width, address space width, etc. As you can imagine, it was heavy on type-level code, has monads and hierarchy of type classes and had to produce C and Java code for different modeling tools. Cooleague was not familiar with Haskell before, barely touched it. He also was recovering from hard divorce and, as he has said later, was not willing to work at all. After a month he delivered changes needed, with tests and ready to use. So my experiences (there are several others anecdotes) directly contradict what you say. Now about RTS and language itself. Haskell has threads greener than Erlang and/or Go. Go's thread stack size is 4K-8K, in Haskell it is about 1K-1.5K. It is possible in Haskell to have scheduler as a library http://hackage.haskell.org/package/meta-par http://hackage.haskell.org/package/meta-par for finer scheduling which is not possible with Erlang and Go. So I question the well-being of anybody who subjects themselves to the pain and torture that is not Haskell.
- whateveracct 7y ago> It is extremely hard to learn I picked up Haskell while still getting my degree on my own. My only training was in C. Payoff was huge within a couple months of starting (didn't even finish LYAH), especially when writing concurrent programs. > I question the well-being of anybody who subjects themselves to the pain and torture that is Haskell. Haskell is so effortless once you get over the learning curve though. I've used less effort & focus programming professionally in Haskell than I ever did in other languages. The types & way programs are structured make so many tasks 100% mechanical, with your only thought being where to direct the mechanics. > If I stood up in a corporate business boardroom meeting for tech analysis on a new project and said "I want to write it in Haskell", I'd get laughed + kicked out. Don't care about those people's opinions in the first place. Never will :) Should be viable for me to write professional software for years to come in Haskell.
- groovebits 7y agoHard disagree on the syntax. ML languages to me have the best syntax and their ease of currying is extremely attractive.
- willtim 7y agoSyntax is the absolute best thing about Haskell and it's ML relatives, especially coming from C++ and Java as I did. It's succinct and very easy to read, without braces, parens and type annotations scattered everywhere. For example, defining a function is as simple as "let f x = ..x.." The succinctness of Haskell really matters when dealing with non-trial code or types. Just compare the type signtaure of "SelectMany" in C# to an equivalent in Haskell.
- mbrodersen 7y ago> I question the well-being of anybody who subjects themselves to the pain and torture that is Haskell. I question the well-being of anybody who refuse to learn anything that is hard to learn. Learning is like body building. No pain no gain.