Live data from Hacker News

Ask HN: Why would anyone choose Haskell to develop applications?

news.ycombinator.com

71–80 of 128 posts

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#71
post #15

Earlier quoted context omitted.

You will get slightly better people but still the wrong people. JS is almost never the right tool for the job, Go is occasionally the right tool for the job, mainly if you need to write something that moves bytes from one fd to another without much in the way of business logic. TBH if you are building something boring you should just use Spring w/Java or Kotlin. This will attract pragmatists that ship code that works…

"JS is almost never the right tool for the job" Except, you know, in the browser...

I assume they meant everything, except the browser (like electron apps or NodeJS on the backend).

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#72

> Does it offer any actual practical benefits over other languages? It sure does. Perhaps you should try it?

Sure, that would be the right approach I guess, but I think the whole point is trying to foresee benefits/problems before wasting time.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#73
post #15

Earlier quoted context omitted.

You will get slightly better people but still the wrong people. JS is almost never the right tool for the job, Go is occasionally the right tool for the job, mainly if you need to write something that moves bytes from one fd to another without much in the way of business logic. TBH if you are building something boring you should just use Spring w/Java or Kotlin. This will attract pragmatists that ship code that works…

Go doesn’t attract mediocrity it attracts pragmatism. I worked on a Scala team for a couple years, had a lot of devs that were “smart”, problem was they wrote really fancy code no one could understand. I then switched to a Go team and it was night and day. I was wildly more productive and the people in the community were not lacking intelligence. Go prioritizes community, it believes that “us” is more impactful than…

I don’t dislike Go and have worked with it professionally on and off over the years. It occupies a weird liminal space between low level languages like C and medium level languages like Java. It was built to solve a set of in house problems that Google faced and it does so well. On the other hand if you end up needing to do lower level work the lack of power renders Go unsuitable. And if you need to do higher level work the lack of expressiveness is almost as frustrating.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#74

When I asked my current employer why they chose it, they simply responded that it attracts the "right" people. From a business perspective, any language is arbitrary. What matters is having clever people around to solve problems.

This is the best answer. I read something similar for Ocaml and finance sector.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#75
post #16
post #15

Earlier quoted context omitted.

You will get slightly better people but still the wrong people. JS is almost never the right tool for the job, Go is occasionally the right tool for the job, mainly if you need to write something that moves bytes from one fd to another without much in the way of business logic. TBH if you are building something boring you should just use Spring w/Java or Kotlin. This will attract pragmatists that ship code that works…

This can cut both ways. Yes, if you choose Haskell, a Lisp, or something like Erlang, you can get smarter/better devs. But the flip side of that is that the types of people who tend to gravitate toward those languages are often more interested in programming for it's own sake and not the domain they're working in. So you get things like people burning hours writing their own libraries and endless tinkering with progr…

I've picked up F# out of a need to get things done.

I got sick of learning framework after framework just to keep relevant. F# is niche so it moves a little slower.

The results have been fantastic. Not only can I solve business problems faster, I'm happier with the resulting code. It's easier to read, test and alter.

I've found some languages a nightmare to work with. Specifically Perl and JS. I've seen brilliant code written in both but that takes more care than most put in. If you have pressure to rush and don't clean up it's just a mess.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#76
post #9

Earlier quoted context omitted.

> but it's not far off either. How "far "off" is it, in terms of correctness, compared to other, more conventional statically typed languages like C++ or Java or Rust?

Sadly, there is not an obvious metric through which this can be answered, but the type system is much more advanced than that of C++ or Java, and as such you can be more precise about the inputs and outputs of a piece of code. As long as take advantage of the type system, the compiler tends to permit far fewer programs that compile, but do the wrong thing, than is the case in C++/Java. You will notice you spend more…

[deleted]

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#77
post #55

Earlier quoted context omitted.

I was clarifying I consider them to be separate categories. Java/.NET cultures are distinctly different to Go/JS/Python despite both categories being mainstream. The former is old, boring and sticks to what works. They are both slow moving, have large established frameworks for each applicable domain, prioritize backwards compatibility, have highly evolved IDEs that support both the language but also the dominant fra…

Python came out in like the early 90s I think when the Berlin wall hadn't been knocked down for all that long. It is OLD and battle tested by many many high profile companies. Granted, sometimes it isn't the right tool and the JVM is. Same is true in reverse as Java has significantly more boiler plate than Python. I do agree Python has changed more over time.

It's about rate of change, not age.

Also about design of the ecosystem in general.

In JVM land almost all code is implemented in managed code. This means the likelihood of severe (runtime degrading) bugs is greatly reduced. It also means in practice you can just step into any arbitrary library code using an interactive debugger to fully follow the flow of execution.

Contrast that to Python where every library worth using is actually written in C against the CPython interpreter itself. This means a few things: Broadly speaking you have just extended the exposure of the core runtime by the amount of code you have loaded in native extensions, meaning more bugs, more severe vulnerabilities and generally a bad day.

It also means that code is "invisible" to the runtime. Python has pretty poor tooling anyway but what little tooling is has becomes useless once your problems venture into C extensions and you end up having to drop down into GDB to work out what is going on. This is made harder by the fact that Python doesn't really play that nicely vith the Valgrind toolkit in my experience making use after free/leaks/etc and other nasty bugs harder to debug than straight C code.

Finally it also means you can't just pick up and move your Python code to a different runtime despite them being available. Unlike Java which will mostly run just fine on Hotspot or J9/other proprietary JVM your Python code is actually now CPython code. In practice I guess this isn't a big deal but it's worth mentioning.

TLDR: Python is old, Java is stable. There is a difference.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#78
post #56

I like the separation between pure and impure code. In his Haskell class Eric Meijer said that pure code are like islands and monadic code is like the ocean, and as programmers we decide how much of a system is pure code. Sorry for being off topic: the new M1 Macs seem to take some of the pain out of large runtimes for compile/build in languages like Haskell and Swift. I don’t have any benchmarks, this is just very n…

Is this the class? https://www.edx.org/course/introduction-to-functional-progra... If not, can you share a link? Thanks!

that is the class! I might take it again sometime.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#79
post #23

For your good old boring business software - ADTs and patter matching combo is, IMO, the most visible, practical benefit over "traditional" languages used in the industry. And something I miss the most when not writing in Haskell.

I haven't used pattern matching since I wrote F# and OCaml ten years ago and I still miss it. So, so expressive.

Re: Ask HN: Why would anyone choose Haskell to develop applications?

#80
Haskell allows to build abstractions that are less leaky than in most other languages.

Take a vector package, for example. It provides you with unboxed vectors that are structure-of-arrays by default with the interface of array-of-structures. That means you can have fast slicing operations in both dimensions - slice by field and/or by indices. Of course you can have unboxed array-of-structure arrays, if you need them, they are there too. But their use is transparent to you as user, however your choice is.

Same is for other interesting structures.

Say you wrote your parsing library. You can provide a rule to compiler such that code "(pchar c `pthen` p1) (pchar c `pthen` p2)" is equivalent to "pchar c `pthen` (p1 p2)" and you get left factorization for all your grammars supported by compiler.

Parallelization is often as far away as adding a par/pseq annotation.

Haskell can remove intermediate lists and fuse mapping over complex structures such as red-black trees - it is done for all of your code so when you do "fmap f (fmap g) rbTree" you will get "fmap (f . g) rbTree" and compiler will try to get you that code by transforming your code where "fmap f" can be pretty far away from "fmap g rbTree".

The pattern matching checks are awesome - compiler will warn you if you wrote more general check before more specific one. The absence of this in C++ made my life a little bit more interesting than is comfortable for me.

In short, most of the time you can write code however you want or need and compiler will support you. As if you are "team programming" with a bunch of smart people - the compiler's authors.

Post reply on HN