Dan Weston westondan at imageworks.com
Thu Nov 29 16:06:18 EST 2007

```Andrew Coppin wrote:
> Dan Weston wrote:
>>   [...] and facilitates "borrow-from-the-future" techniques where
>> useful with infinite data structures or recursive algorithms.
>
> And this, gentlemen, is just one of the reasons why Haskell gets
> labelled as "scary".
>
> It's very hard to explain what this enigmatic riddle-like statement
> actually *means* without a very long exposition. (Heck, *I* haven't
> worked out how to "borrow from the future" yet...)

Birds don't fly because it looks impressive, they just get tired of
walking! Scary is refusing to fly because you are an expert walker and
don't want to look foolish as a beginning flier.

Some people find dialogs less scary that buzzwords (hey, it worked for
Socrates!) Let me rephrase some Haskell benefits in less scary language,
now that the word count is not at a premium:

Son: I need some new clothes. Gimme some money.
Strict Dad: How many money do you need (pulls out wad of bills...)
spending!
Lazy Mom: Here's a credit card. Just charge what you need.

2) Steal from yourself and others

Student: I need a list of prime numbers
Teacher: Easy. I'll give you the first one: 2. Now test each odd
integer starting at 3 and try dividing by every prime up to its square root.
Student: But I need to already know the primes in order to divide
them into my candidates, don't I?
Teacher: [Lying] No problem, I have an infinite list of them! I'll
make you a deal. I'll feed you these divisor primes as you need them,
and you tell me whether your numerator ended up being prime.
Student: Ok, 3 is the next prime number
Teacher: [Surreptitiously writes this down on his list]
Student: Hey, you're cheating! I'm the one doing all the work here!
I'm generating primes faster than I need them, so really I'm stealing
from myself. What's the use pretending I'm getting them from you?
Teacher: No, I'm just doodling, I really do know all the primes.
Your code is much simpler with me handing you the divisor primes anyway.
What do you care where I get them from? It's no extra work for you!

3) Running in circles

Athlete: I run on an infinitely long track. I can go forever in a
straight line without coming to the end.
Trainer: Dummy, you're running on a treadmill. Look around, the
walls aren't even moving.
Athlete: I can't, the lights are off. The only thing I can see is
the lighted path at my feet.
Trainer: Moron! Don't you see that number "2" painted on the
treadmill that keeps repeating every couple meters?
Athlete: Of course, funny how someone had the patience to keep
painting the number 2 over and over. Only God could have done such a
wondrous thing.
Trainer: Has it occurred to you that that is the same number "2"
going by each time?
Athlete: Prove it!
Trainer: Easy, I'll just write a "3" next to it. See, the "2" is
gone, now it's "23".
Athlete: Now who's the dummy. You know this ground is immutable,
chalk won't stick to it. You must have transported me to a completely
different track where the number "23" is written over and over. That God
must be powerful to have made so many tracks like this.
Trainer: Your logic is too lazy for me. You can't tell the
difference between an infinite list and a cyclic one.
Athlete: What do I care? I still get all the exercise I need!

Now that wasn't so scary, was it?

All in fun...
Dan

```