> On one hand, 'imperative' means 'a list of operations
> that produce a sequence of results'. We contrast that
> with 'declarative programming', which means 'a list of
> results which are calculated (somehow) each step of the
> way'. Mathematical proofs and SQL queries are
> declarative. Most of the things we think of as
> programming languages are 'imperative' by this meaning,
> though, including most functional languages. No matter
> how you slice it, Haskell is not declarative.
Either I'm confused or the author is.SQL is declarative, sure, but I don't think mathematical proofs are. Sometimes you do declarativeish things like, "Let x be the solution, known to exist, to this unsolvable problem." But I think the structure is fundamentally very imperative; ignoring the syntactic sugar, formal mathematical logic is a sequence of logical transformations that leads from hypothesis to conclusion.
I can chalk that up to confusion or inexperience on the author's part, but the bit about Haskell really confuses me.
I'm still quite new to functional programming -- just emerging from the "how the heck do I do that without for loops?" phase -- and the experience really has been one of learning to program all over again. As in the CS 101 days of yore, I have to spend a lot of time trying to figure out how to accomplish simple things, dealing with alien logical consequences and constructs.
Now, Scala lets me do things either way, and I like to think I'm getting to the point where that's an advantage rather than a crutch. But looking back over the last little while, I can't imagine how you could possibly slice Haskell in such a way that it's declarative at all. I mean, I've been banging my head against the relentless declarativity of it for a while. I'd like to think if there were crutches, I'd have found them.
Unless the author is talking about something silly, like the fact that it's ultimately compiled down to an imperative language to run on a real processor . . . I can't figure out what he's talking about. And I don't know whether to chalk that one up to confusion on his part or inexperience on mine.