[Haskell-cafe] let and fixed point operator

Dan Piponi dpiponi at gmail.com
Thu Aug 30 17:38:25 EDT 2007

On 8/30/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:

> Yeah, but... programs aren't like mathematics. I know people claim that
> they are, but they aren't.

But the raison d'etre of Haskell is to make programming more like
mathematics. That motivates everything from the fact that it's a
declarative language, and the support for equational reasoning, to the
fact that IO happens in a monad, and the option to use primes on
variables names.

> In mathematics, if you write "x = f y" you mean that these two
> expressions are equal. In Haskell, if you say "x = f y" you mean *make*
> then equal!

Haskell is a declarative language, not an imperative language. When
you write "x = f x" in Haskell, you're declaring to the compiler that
x equals f x. In an imperative language like Java, the line x = f(x)
gives the compiler the imperative to emit instructions to store the
value of f(x) in a 'box' called x. In Haskell, there is no box.

(When you get down to the nuts and bolts, a Haskell compiler and a
Java compiler may ultimately actually do the same thing here, but the
way you think about a language is as important as what instructions
the code generator emits.)

More information about the Haskell-Cafe mailing list