Hacker News new | ask | show | jobs
by foopdoopfoop 2435 days ago
Sounds 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.

3 comments

I have taught both Haskell and Java and there is no comparision in difficulty. Teaching basically all of the Java language can be done in a couple of days (excepting generics, which take another day or two), and the language bugs are always "shallow".

Haskell on the other hand creates crazy errors which confuse students, and often require extensive teaching to understand what is going on.

I'm happy to accept the possibility expert Haskell programs will be more productive in the longer term, but the learning is MUCH harder.

For example, here's one "simple" haskell error:

Prelude> print 2 + 3

<interactive>:9:1: error: • No instance for (Num (IO ())) arising from a use of ‘+’

Now, it's not too hard to figure out what's gone wrong, but when doing beginning learning, explaining what (Num (IO ()))) is isn't something I want to be doing. No Java error gets that complicated.

That error message is easy to understand.

Explaining why a language can't handle print 2 + 3 is priceless.

It seems like an interesting language to learn for the sake of learning but introducing this to a beginner is not fair.

> I have taught both Haskell and Java and there is no comparision in difficulty.

Interesting. How much real world experience did you have with both languages before teaching it?

What kind of error would you like to see here instead ?
Maybe just one extra line like this?

    Prelude> print 2 + 3

    <interactive>:3:1: error:
        • No instance for (Num (IO ())) arising from a use of ‘+’
        • The expression `print 2` :: IO ()
        • In the expression: print 2 + 3
          In an equation for ‘it’: it = print 2 + 3
Just adding the one line telling telling you what was `IO ()` is helpful. ghci obviously knows what it was here.
This suggestion is a straightforward, easy to implement improvement. Many compilers have serious UX problems because their authors don't take UX seriously. Elm and Rust are two languages getting this right.
The Rust compiler does a great job of making suggestions for how you can fix your code, which is tremendously helpful for the majority of cases where your mistake was simple. There is no reason (in theory) that GHC can't offer the same level of guidance.
Counterpoint: learning your first language and learning languages later in your career are very different processes and learning Haskell with a background in OOP languages may be harder then learning it as your first.

> Arguments over programming languages often become emotional and skip past many of the practical business concerns that make programming languages valuable in the first place

> 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.

> I can't fathom a world where JavaScript is less efficient than Haskell.

You can't fathom a world where a compiler can more easily produce efficient machine code from a statically typed language with very few semantic corners than from a dynamically typed language with lots of sharp corners plus reflection? I think you may need to meditate on the task of compilation a for a bit.

Unless you mean efficient for the programmer, in which case you are mistaking the up front effort of getting things to type check for additional effort. Usually it spares you the same number of iterations in debugging and testing, and the type checker is a lot faster than running unit tests. Plus the first time you make a major refactor to a program by making the change and then fixing everywhere the type checker complains, and that turns out to be it, it all works, it feels like you just mutated into a superhero.

Efficient use of time I think the parent poster was referring to.

You could have the project finished quickier in Javascript. Would you disagree? Does choosing haskell increase development time (ignoring major rewrites)?

I'd say it depends heavily on what you're writing. If it involves graphics, Javascript is going to be substantially less annoying, at least initially. However, the version you write in Haskell will be much more reliable, and much easier to progressively refactor and scale up, whereas in JS, the weird edge cases and lack of static guarantees will gradually pile up and make the project a chore to maintain.

For something non graphics related that you're building by yourself, if you already know Haskell, it's a no brainer, due to the high expressivity ceiling. Once a team is involved, the right choice (as always) basically just depends on what people already know.

> You could have the project finished quickier in Javascript. Would you disagree?

That very much depends on the project (I have a lot of experience with Javascript, Typescript and Haskell).

maybe you shouldn't be spouting answers when you should be asking questions then
Then keep quiet.

I agree completely with @foopdoopfoop.

You 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 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.