The Dongola Times

(Anachronistic) Dispatches from the Kingdom of Makuria.
16th of June, 2013

Wild Haskell Analogies #1: Wave-Particle Duality

One of the great ironies of the Haskell programming language is that, even though it proudly makes reference to category theory, which is like abstraction of abstraction (the mathematics of mathematics, the philosophy of philosophy), none of its practitioners let themselves draw wild analogies that can be proved, however circuitous the route. Analogy is the most-mystical thing about mathematics and thinking in general, because it is spontaneous and unlaboured and it just demands to exist. Category theory kind of legalises it, and so they correctly recognise it as “abstract nonsense.” But as for me, let me take my licence now.

So in quantum physics, there is this thing called wave-particle duality. It says that every particle is actually a wave, until it is observed, in which case it becomes a particle. Particles can be placed precisely in time and space. You know where the phone is, for example. But waves can only be located by probability. So the signal by which the phone communicates is a bunch of bars that bounce up and down on the phone’s display.

In Haskell, you can very easily have a function that just returns an infinite list of numbers. And you may use that function, you may call it and use its results. And yet the program will not hang while the last element of the infinite list is calculated; why? Because in Haskell, like in quantum mechanics, the next item of the infinite list is only ever turned into a particle when the programmer seeks to observe the result. No matter what your program may do with the infinite list, it will remain a wave in the computer—neither here nor there—until someone does input-output, and then this observation causes a collapse of Haskell wave function.