
Why Haskell Is Important - lelf
https://www.tweag.io/posts/2019-09-06-why-haskell-is-important.html
======
oddity
> Haskell’s core principles, like purity and isolation of side-effects, [are]
> understood and appreciated by more today than ever before

If I were to summarize what I think are the most important ideas in the modern
functional programming world, I would start with purity and isolation of side-
effects (and the mechanisms that have arisen to manage side-effects). However,
it seems like most discussion about functional programming centers on type
systems and most of what gets imported to other languages is just fancy ways
to do iteration. Purity and side-effect isolation, it seems, is seen as a
weird curiosity that must be broken in order to write Real Software (TM). It
feels like I've slowly watched functional programming get lost in translation
the same way object oriented programming was.

I'm sure the past decade or two of hype around FP has done some good to real
code bases by exposing new ideas to developers who might never have seen them
before, but I worry that in another ten years, I'll open up someone's code and
find a nested callback hell where state mutations are impossible to track.

~~~
rocqua
The nice thing of functional languages is the establishment of invariants. A
large part of that lies in purity / isolated side-effects. However, much of it
comes from the type system.

When ported to 'imperative' languages, those factors from the type system help
establish invariant given that people don't use all the footguns. Whilst it is
sad there are still footguns that can ruin your invariants, getting better
types helps you move away from the footguns. Moreover, it is much harder to
export purity to different languages than it is to export good type systems.

And really, the good thing that is being taken over is 'make it easier to
reason about correctness through invariants'.

~~~
zzzcpan
Functional languages don't establish invariants, invariants is an abstract
math concept and math way of thinking. Side-effects, on the other hand, have
an important place in programming and CS.

~~~
kazinator
If you can't make hordes of side-effects sit up and beg, in a large,
complicated program, you can't call yourself a computer scientist or
developer.

------
philzook
I think many of these comments are asking too much of a single short article.
Or they want the article to be addressing the questions that they have rather
than the question it was written to address. The author is stating very high
level reasons about why Haskell is a fairly unique language, as a (relatively)
practical, popular, and pragmatic vehicle of programming language progress
(mind your ps).

For those that want concrete reasons for why it would be useful for a
beginner, my personal honest opinion is that it may not necessarily be.
Haskell does seem to require a decent amount of investment before it becomes
practical. You may derive benefit from seeing the functional style in an
enforced context. I know it informed and changed my python style a quite bit.
You may find that these patterns were all around you the entire time and you
didn't notice it, like learning new vocabulary words.

Anecdotally, my interest in Haskell seems to have been very good for my career
so far and I have not had difficulty finding jobs that coincide with my
interest in typed functional programming generally. Perhaps I have been very
lucky.

------
amelius
Unbalanced post because it doesn't address evidence against Haskell. For
example:

\- Performance is lower than most systems programming languages.

\- Performance is also more difficult to reason about.

\- If Haskell is aimed at building large and complex systems, then where is
the evidence, e.g. an operating system? (A compiler is just a pipeline so
doesn't count; it is of a different kind of complexity)

\- The GHC compiler internals are badly documented (despite some great books
about its global architecture). Why do people who pursue clean software
engineering methods not follow good software engineering practices?

~~~
jose_zap
I’m a bit conflicted about your point here, because they seem cherry-picked to
highlight disparate aspects of Haskell that don’t make it less interesting or
important.

Haskell is more often than not sued as a general purpose language, not as a
systems language. Its performance is actually outstanding, usually equal to
Java and often close to C. This means that Haskell can be safely used in any
domain were java would be fast enough.

I find also somewhat arrogant to claim that there are no complex systems built
in it. Just take a look at the webpage publishing this article. They mention
several projects of great complexity. Here’s an example:
[https://www.tweag.io/posts/2017-03-13-linear-
types.html](https://www.tweag.io/posts/2017-03-13-linear-types.html)

They are using Haskell as a prototyping language that lets the refactor and
radically change the direction of their solutions at a low development cost.
Haskell clearly is helping solve complexity here.

Also, where did the claim that GHC is badly documented come from, and how is
it relevant to Haskell being important?

Just looking at randomly selected file in the repo, it looks actually quite
well documented:
[https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/simp...](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/simplCore/FloatOut.hs)

~~~
amelius
> they seem cherry-picked to highlight disparate aspects of Haskell

I only said that the article was unbalanced and provided some counter
examples. I didn't say that Haskell does not have many good uses.

------
rkachowski
It seems like the condensed version is "The idea of Haskell is more important
than the language itself", which doesn't really sound like a convincing
argument to answer why the language is important.

~~~
willtim
There was a hackernews post yesterday where the top voted comment asserted
that computer science and maths is (in practice) only useful for data
structures and algorithms; everything else needed either physics or social
science. This is why Haskell is important. Haskell will help teach people the
mathematics behind program construction: how to write composable code, how to
reason about effects, how to write consistent, general, less ad-hoc APIs.

~~~
UncleMeat
But it doesn't seem to.

Products built in haskell don't seem to have dramatically lower maintenance
costs. They don't tend to have features that other products don't have. Nobody
buys math.

In all of the recruiter spam I get, the only time that recruiters lead with
"what language we use" rather than "what we are building" is when the company
is using haskell. This seems backwards and gives a poor impression.

There might be 100 POPL papers that I can use with haskell extensions but
ultimately the act of coding is nowhere near the top of the list of important
things when building systems to solve problems.

~~~
willtim
> Products built in haskell don't seem to have dramatically lower maintenance
> costs. They don't tend to have features that other products don't have.

That is your anecdote, mine is the opposite. Using Haskell at my place of work
we have lower maintenance costs than other competitors that use Python. We
also have features they don't have, such as checked purity (a guarantee that a
financial calculation is reproducible) and transparent
batching/caching/provenance (made possible by Haskell's expressiveness). None
of this would be possible in Python or Java.

Language/notation, is IMHO critical for the ability to think using the right
abstractions. To take your argument to the extreme, we should all be still
using machine code, because tools don't matter.

------
dragonsh
In our startup due to earlier experience working with pandoc, we tried to give
Haskell a try.

It was very difficult for team to pick up and then they took longer to
accomplish very little. It did drain out confidence and make us think, we are
not so clever.

So later moved to Python, and suddenly things changed. In the meantime on
personal level at present learning lisp. Once finish will try to work on
Haskell again.

I think Haskell along with lisp will be good on learning functional
programming for my team. It will help them solve logical problems using
functional paradigm as well. So in future they can pick up procedural or
functional paradigm to solve logical problems better suited to problem at
hand.

~~~
willtim
There is unfortunately a large learning curve for production Haskell. It's a
very different language to most imperative object-oriented ones, that are all
broadly very similar. However, the concepts that folks will learn (Monads,
Monoids, Functors, Profunctors etc etc) are taken from math and will likely be
around for another 100 years. This is not disposable knowledge, and for me at
least, it made a refreshing change from learning ad-hoc concepts from each
successive OO fad framework I had to deal with.

~~~
alephu5
I have been learning Haskell from these two books over the last 4 months:
"Practical Haskell by Alejandro Serrano" and "Practical Web Development with
Haskell" by Ecky Putrady. With other languages I usually just skim through a
book figuring out how the basic data structures, flow control and operations
then start writing a toy CLI app or server but with haskell I felt completely
lost when trying to follow examples in library documentation, even after
several weeks of reading books. So I found it's really worth carefully going
through the programming book and doing the exercises, at least beyond the
monad transformers section, before diving into real code. I'm over the hump
and am writing & understanding working code now, but still a long way from the
level of mastery I have with imperative programming.

~~~
ratww
I think the problem with Haskell are not the concepts per se, but rather the
terrible ergonomics (too many cryptic operators, point-free syntax, language
extensions) and TERRIBLE learning material.

Monads, for instance, are hard to invent but are easier to use than most
libraries. Most people won't come up with Monads and will only consume them.
But books and Monad tutorials focus instead on explaining what they are and
how they were invented. This is unnecessary.

Another problem is that the coolest things (monads, lenses, syntax extensions)
are bolt-on, rather than built-in. So we compromise syntax (and sometimes
consistency) in the name of extensibility. Such fundamental things should be
in the StdLib. This is the same problem Javascript suffers from.

I strongly believe that a new language with the same semantics but a more
approachable syntax and better learning materials (like Python) would be way
more successful. Maybe that's OCaml but I'm not too experienced in it.

~~~
vkazanov
Syntax-wise Ocaml is waaaay weirder than Haskell. In fact, Haskell is a pretty
typical representative of the whole ML language family, with StandardML being
the cleanest of them all.

~~~
ernst_klim
Actually, OCaml is much closer to the original ML that SML.

------
pythonwutang
“Why Haskell is important” according to a Haskell consulting company. So
taking this article with a big grain of salt.

Haskell might be a great language but barely anyone (besides CS academics)
uses it.

We use java and python in production because (among many other things) they’re
very popular.

Popular languages have large archives of open source packages and easy to find
communities that save enormous amounts of headaches and time. The opposite is
true of Haskell, at least for now.

~~~
danielscrubs
All valid points. It could in the future be done in a better way is not really
interesting when you are working with your boss breathing down your neck.

Still my fellow academics will try to push in the direction they see fit.

------
dmitriid
The most important thing about Haskell is this: serving as a test bed for
programming language theory and ideas.

Some of these ideas eventually find their way to other programming languages.
Other ideas remain just ideas and academic experiments.

~~~
Koshkin
I don’t know about that, Haskell has been a stable language for a while now...

~~~
sullyj3
Google "haskell motto"

------
anm89
I don't doubt that Haskell is a great language, but in my experience, if you
have to publicly anounce to people at length why a thing is x, it isn't x.

~~~
willtim
Not true at all. We live in a world were marketing determines the standards
used. The current trend is actually to give programmers less guidance on
writing correct, composable code ("Dynamic" scripting languages).

~~~
bsaul
I think that was true 6 or 7 years ago, but we’re heading completely to the
other side. Typescript over javascript, rust over c, swift over objective-c,
dart adding improved support for static typing, go thinking about generics,
etc. I think everybody now go toward compilers or PL enforcing more ( and as
soon as possible) rather than give the programmers more dynamic features.

------
gabrielblack
I'm mainly a C/C++ programmer, I use also python, I'm learning Go and I'm
reading about Rust. But I think my programming skill are a little
"stereotyped", so I'm looking for something different, you know, to open my
mind. So I read the article, here on HN, about all the "exotic" languages,
Lisp for example and others. I was reading this article about Haskell and I
think it's too abstract to stimulate a novice to go further. Some details
about the advantages cited and related examples should be present to give
motivation to the newcomers. On the contrary, the part about the evolution
gave the impression of an immature language. My two cents.

~~~
molteanu
Question is, why would you want to consider the more "exotic" languages? What
would the motivation be, for you, in trying out new languages?

The hint that these might not be for you, yet, is right there in your
question. You consider yourself a C/C++ programmer. I think most of the folks
who grok these Lisp and Haskell languages just consider themselves programmers
plain and simple, or engineers, or curious little heads, or artists, or
something similar.

~~~
gabrielblack
I would consider other programming languages different from c/c++ because I
don't want my capability to solve problems bonded to specific tools, this is
the motivation I learnt other languages.

Evolution maybe, the animal becoming too specialized, in case of environmental
changes, will face the extinction.

I'm looking for tools better able to solve specific problems. You can stick
screws with an hammer, maybe it's faster but a screwdriver tool exists to
better solve the problem and its evolution the electric screwdriver is the
state-of-the art and probably the best choice. Now, having to deal with a
limited resource, _time_ , I have to choice what to learn seriously and this
article doesn't help me to do a choice. Those choices also could influence my
professional capabilities in the futures, because, you know, I do the
programmer to live.

> just consider themselves programmers plain and simple

Plain and simple programmer is bullshit, IMHO. What do you write in your CV,
"professional programmer plain and simple" :-) ? Oh, please, save your
rhetoric.

~~~
molteanu
You don't go lisping to make your CV look pretty. That doesn't help at all. On
the contrary, it might be even damaging, as some discussions here on HN have
shown in the past.

If you're "looking for tools better able to solve specific problems", your
best bet right now might be Python. It ain't pretty, but the momentum behind
it is tremendous. Tons of libraries, books, how-to's and developers out there
willing to help. From a practical point of view, you couldn't ask for more.

~~~
gabrielblack
> You don't go lisping to make your CV look pretty.

Look, I didn't write that. This is _your_ affirmation. As I wrote, and I
repeat, I think that being specialized to procedural/object languages, for
some kind of problems that could be a limit. So I'm looking for different
paradigms to change the way I approach problems. Now I have a limited time,
how I should spend it ? Now, because I'm a professional programmer I would
like something I can use and improve my CV. So what?

> your best bet right now might be Python

Again, its paradigm is a stereotype of other language I know.

What's your problem ? Are you the author of the article ? Look, I think that
the point of that article is "study Haskell, trust me", so it isn't an help
for newcomers. I only express my opinion. The title is "Why Haskell is
important" and I think it fails to explain the more important point that is
"why". So, why ? Moreover, why Haskell and not F# or Erlang, for example ?

------
rocqua
I think that when mentioning the effect of Haskell on other languages, things
beyond rust deserve to be pointed out.

Modern C++ has sum-types and 'optional' types.

Python has lazy evaluation (generators).

Java-script really likes higher order functions (reduce, map, etc).

~~~
yxhuvud
> Python has lazy evaluation (generators). > Java-script really likes higher
> order functions (reduce, map, etc).

It is a hard sell to claim that either of these were invented or even
popularized by Haskell. Just because something has functional roots, doesn't
mean Haskell is related to the success of the feature - there are plenty of
older languages (LISP!) that have the same features and that likely has way
bigger influencing effect.

~~~
jose_zap
In fairness, the list comprehension syntax in python was taken directly from
Haskell:
[https://wiki.python.org/moin/PythonVsHaskell](https://wiki.python.org/moin/PythonVsHaskell)

------
Koshkin
I’d love to see a Haskell in Lisp’s clothing. (The Haskell that exists has so
little syntax that source code often looks like a mass of unstructured text.)

~~~
privethedge
There was Liskell, but it seems it's dead.

[https://wiki.haskell.org/Haskell_Lisp](https://wiki.haskell.org/Haskell_Lisp)

~~~
platz
[https://github.com/lexi-lambda/hackett](https://github.com/lexi-
lambda/hackett)

Under active development, still WIP

------
linfocito
Those very same arguments could be rather used to say why Racket is important.

