
Learning Haskell as a non-programmer (2014) - sridca
https://superginbaby.wordpress.com/2014/11/18/learning-haskell-as-a-nonprogrammer/
======
theseoafs
> Honestly, I still don’t really understand imperative languages. Why would
> you want things to mutate?

Because in the computer, things need to mutate, and so a language that doesn't
mutate is therefore far from the computer.

EDIT: Put another way: Haskell does support mutation, but inside of particular
monads. So obviously mutation is useful. Learn why it's useful in Haskell and
you'll see why it's useful elsewhere.

~~~
BillMryes
In the computer, you also have no descriptive variable names and make
excessive use of gotos. This is far from a good argument.

> Haskell does support mutation, but inside of particular monads.

You are mistaken. Monads do not involve mutation; that would defeat their
entire purpose. Although it's true that the monadic code is being compiled
into assembly that involves mutation, just as $LANGUAGE code is being compiled
into assembly that includes a lot of goto.

~~~
tome
> You are mistaken. Monads do not involve mutation.

Indeed. IO and ST involve mutation. They just so happen to be instances of
Monad, but that's tangential.

~~~
rtpg
they don't involve mutation on the language semantics level. The mutation
happens through the runtime (via calls to the C FFI).

In reality they're implemented in a mutation-heavy way for performaance
reasons, but on the language level absolutely no mutation happens ( it's the
whole World -> (Result, World) analogy)

~~~
theseoafs
The whole point about where the mutation happens and how the language remains
pure in spite of it is not awfully relevant. The point is that Haskell does
support real, bona-fide mutation in its standard library (see for example its
support for stateful IO arrays). So obviously mutation is useful, regardless
of whether you're doing that mutation behind a pure interface.

------
plongeur
> To me, it’s a bit like saying that if you already know English, then
> learning a second language will be more difficult for you than if you didn’t
> know any language.

To master a first native language takes at least about 16 years for most
people ... I think you can reasonably master a second language way faster by
leveraging language analogies. I also have a very hard time believing that
learning Haskell is easier if you lack programming experience in imperative
languages.

> along with learning Emacs, but they are mere constituents in a continually
> growing pile of stuff I still need to learn.

At no point she gives a reason for why to learn Haskell in the first place. I
mean you only have so much time - why spend time learning Emacs just out of
nowhere?

> True Confession: I didn’t know Github existed until I started learning
> Haskell; I didn’t even know what version control was. So, as I was starting
> with Haskell, I had Linux, Git, an invitation to join an IRC channel (a
> wut?)

So where is her GitHub repo? Can't find the link. There is probably a lot of
very smart Haskell code to be found, I guess.

> Honestly, I still don’t really understand why people like imperative and OO
> languages.

She writes that she has no experience in other language paradims but she does
know why it's worse than functional approach? Sure ...

The only thing missing in this post is a humblebrag comment about how she just
got a dev position at Google ...

~~~
tel
This feels needlessly judgmental.

She has a friend who likes Haskell and taught her. The things he taught make
sense to her. Perhaps she doesn't have the experience to make a fuller
judgement, but that doesn't stop her from talking about what she's personally
discovered.

The amount of derision you've managed to read into that is remarkable.

~~~
plongeur
I think you are right - my comment is definitely a bit harsh. Certainly I
don't hold a grudge against her b/c of this. But this type of over-hyped blog
post fits into a weird and annoying pattern on HN as I see it. At the moment I
cannot say specifically why I do react so allergic to it.

~~~
coolsunglasses
>over-hyped blog post

It's not over-hyped until there's a $1mm kickstarter ;)

Also you're not leaving my co-author a great impression of the tech industry.

She's been reading this thread and you people are being terrible.

~~~
plongeur
Okay, I'm sorry! Didn't want to make her feel bad! :)

Then again - she's already making bold statements about correct software
development paradims ... I guess, some healthy humbleness may be useful if you
don't want to be judged yourself.

~~~
coolsunglasses
Stop making excuses. She didn't post this to HN. She can write whatever she
wants.

~~~
AnimalMuppet
Sure she can. But at least one of plongeur's criticisms was completely valid,
even if stated a bit harshly. She does in fact write that she has no
experience in other language paradigms, but then exactly says "Honestly, I
still don’t really understand why people like imperative and OO languages."
That is, she criticized people for choosing other paradigms that she
admittedly doesn't have the experience to criticize.

Then she doubles down on defending that part against criticism, while
complaining that that seems to be the part that HN is attacking. Um, maybe
because that part is weak?

Look, the point isn't to tear her apart. The point is that it's valid to
criticize that part of what she said, without it becoming a personal attack.

As for the rest of what she said, that she mentions that we're not
criticizing: That's because (other than the "learning a first language is
easiest" part), there's not much more to criticize. She wants to learn
Haskell? Great. Go for it. She wants to teach it to others who don't know any
programming language? Great. Go for it. She wants to document her trail to
make it easier for others? Wonderful! There's nothing whatsoever to criticize
with any of that.

And as for why it's getting criticized here on HN when she didn't post it
here: Somebody did, and we're commenting on it. That's kind of how the
comments section of HN works. The only way it could be different is if it
wasn't posted here (so nobody read it here; probably not a net win for
anybody), or if HN had a way to post something where no commenting was
allowed.

------
asattarmd
I thought people say learning Haskell as a first language is easy because

1) you don't have do a lot of unlearning. See, you still don't understand why
you want things to mutate. Experienced programmers (in other languages) mutate
things in every single line of code they write. They have to unlearn mutating
things to learn this.

2) It's closer to mathematics which many people know.

I think the problems you faced are actually problems because you read a book
that was meant for programmers. Hell, you'll face these problems even if you
read a C book that is meant for programmers.

I still think, Haskell (as a language) is a good first language.

~~~
kazinator
Even newbie computer users understand mutation, because they have moved files
(or other objects, like mail box items) from one place to another, deleted or
renamed them or edited their contents.

Mutation is also something exhibited by everyday objects. This is modeled much
better by object-oriented programming with mutable state. More importantly,
the rigid typing of Haskell isn't found in the real world in which backpacks
can hold dissimilar items, and donkeys can mate with horses to produce sterile
offspring.

Haskell is close to mathematics, sure. Many people know mathematics. However,
many people do not know _that_ mathematics which Haskell is close to! So your
(2) is a slight equivocation on the term "mathematics".

~~~
tel
Mutation is just how you cut up time.

If I pick up a coin and place is 6 inches to the left I've mentally cut the
world into three epochs, the prior, the mutation, and the posterior. Thus I
feel I mutated it.

If I drop a ball, I can do the same trick and cut the world into the before
and after of my releasing the ball, but for the duration of it falling I think
of _physics_ just happening. This is smooth, continuous, and not a set of
discrete mutations.

The math backs this up as well in the sense that integration is _exactly_ what
lets us convert the world of mutation into the world of constant physics (FRP
from the "continuous time denotational semantics" perspective of Conal Elliott
not the usual way the term is abused).

So to claim that "everyday objects" are beholden to mutation or immutability I
think is a game of confusing the map with the terrain.

~~~
seanmcdirmid
Mutation is a function over time, for sure. Most people understand the change
and not the continuous function behind the change, and many processes are too
chaotic to be described by nice clean continuous functions (a physical
simulation with instantaneous collisions...). I believe even FRP uses steppers
for those kinds of things.

Most people think in terms of mutation, not in terms of the abstract functions
that cause values to change over time.

~~~
tel
I think this is just a vocabulary difference, not a genuine mental one.

When I see a ball falling I don't think of it moving forward and accelerating
in an infinite number of infinitesimal mutations---I see it as being in the
state of falling and recognize the space of actions I could perform in time
with it. There's mutation in the sense that I cannot arbitrarily go back in
time. There's immutability in the sense that the rules governing that motion
are not "staged" in any way outside of the interference of my hand.

A better example is perhaps catching a fly ball as an outfielder in baseball.
I _absolutely_ cannot be processing that motion as a set of mutations in order
to function---instead, I predict according to a "mathematical pattern" if not
a formula, where it will land based on scant observation of segments of its
space-time trajectory.

And that's all more or less instinctual, I believe. It must be in order for me
as an outfielder to execute my task. That stuff needs to just be built in to
my brain.

So while ultimately FRP and physics might be "implemented" (ha, ha,
philosophers forgive me) in discrete steps, there's a vital model of each
which is continuous.

~~~
seanmcdirmid
Many behaviors are continuous, it is just that many are not. I am here today
and gone tomorrow, why? It doesn't matter, it just is! If all I had to worry
about in a physics engine was F = ma, life would be a simple continuous
function, but it turns out collisions just ruin that.

If you really want to get in the thick of it, take Conway's game of life (or
NKOS if you can stomache wolfram): there is quickly in a point in a physical
process where you don't know what happens next without the previous state.

~~~
tel
To be clear, I'm not arguing that either mechanism describes all
things—actually the exact opposite, that neither is sufficient.

------
spv
Dijkstra's comments on using Haskell as first language for CS Undergrads
[http://www.cs.utexas.edu/users/EWD/OtherDocs/To%20the%20Budg...](http://www.cs.utexas.edu/users/EWD/OtherDocs/To%20the%20Budget%20Council%20concerning%20Haskell.pdf)

------
corysama
Here's an audio interview with (I believe) the same person on the same topic:

[http://www.functionalgeekery.com/episode-19-julie-
moronuki-a...](http://www.functionalgeekery.com/episode-19-julie-moronuki-and-
chris-allen/)

~~~
coolsunglasses
Yep, that's Julie and I. Had a lot of fun talking to Proctor.

I don't think it was the case at the time of the interview, but Julie is my
coauthor for [http://haskellbook.com/](http://haskellbook.com/) now.

------
quadrangle
As a comment on the post itself already says

The Haskell Wikibook
[https://en.wikibooks.org/wiki/Haskell](https://en.wikibooks.org/wiki/Haskell)
is the very best option for those with _no_ programming background.

~~~
coolsunglasses
I'm going to disagree, particularly for people with _no_ programming
background, as it's often incomplete and lacks exercises.

Some (not all) of the material that is there _is_ good though.

~~~
quadrangle
Um, the Wikibook _has_ exercises, and you can add more, you know.

The incompleteness is not relevant here. The last quality someone needs when
they have _no_ experience is _completeness_. Sure, the Wikibook isn't complete
(but you can add to it where it's missing!), and more exercises would be good.
But for anyone coming from _zero_ , the priority is being the best overall
introduction to the concepts. Once you're well in the door, then you aren't a
total beginner anymore.

The elementary track of the Wikibook is a superb overall introduction. I
wasn't saying it stands alone and is all anyone ever needs.

~~~
coolsunglasses
I don't really agree with the approach enough to make the wikibook into what I
think is needed without rewriting most of it, which is why I started writing a
book instead.

I go over some of the problems with other resources here:
[http://bitemyapp.com/posts/2014-12-31-functional-
education.h...](http://bitemyapp.com/posts/2014-12-31-functional-
education.html)

I didn't touch on the wikibook in part because people have this weird
partisanship about it that I haven't yet fully understood.

------
ademarre
_Learn to program and do it with Haskell_ — In the back of my mind I thought
this was covered, but apparently I was wrong. Could an intro to computation
textbook using Haskell be a good alternative introduction to CS?

~~~
nandemo
Hutton's _Programming in Haskell_ covers that.

I'm not sure if it works as a good intro to modern Haskell, though.

------
revskill
The inspiration that brings Haskell to me is the similarity when you do : ls .
| wc -l on console. Each monad is to be composed to each other, without
knowing others. Each monad is self-controlled and has its own world. Pureness!

~~~
Peaker
That's not "monads composing" there...

~~~
revskill
Oh, i'm wrong with terminology. I mean "chaining".

------
alexashka
"So, as I was starting with Haskell, I had Linux, Git, an invitation to join
an IRC channel (a wut?) and, er, “a text editor” thrown at me. "

If this doesn't strike you as very WRONG, I don't know.

How about codecademy in a browser instead. Some folks shouldn't teach.

~~~
Trufa
I don't agree with your comment, but I did want to point out that I think
there's no Haskell codecademy course.

~~~
alexashka
There's a very good reason for that

