Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't know who you've been talking to that considers Haskell to be an imperative language, but that's nonsense. Haskell is about as far from multi-paradigm as you can get. Do-notation is nothing but syntactic sugar for regular monadic expressions, which are pure functional in every way.


Merely quoting Simon Peyton Jones and Philip Wadler in their paper from 1993 "Imperative Functional Programming" [1].

Chaining monadic binds with a `do` is the textbook example of imperative programming (it's actually the very reason why the keyword 'do' was chosen for syntactic sugar, because it captures perfectly the imperative aspect: "do this and in this order").

You seem to think it's a bad word but I really don't understand that. Haskell is both functional and imperative, there's really nothing wrong about it.

[1] http://research.microsoft.com/en-us/um/people/simonpj/Papers...


Huh. We clearly mean different things by "imperative programming". To me, sequential computation is a necessary but really-far-from-sufficient aspect of imperative programming. A monadic expression is still an expression, not a statement. It is still referentially transparent. I don't know how you can look at a referentially transparent expression and call it imperative other than by being very liberal with your definitions.


Because monads allow you to basically embed "Algol" into Haskell. It's super imperative, despite it being interpreted as a pure function.

I'd actually go so far as to say Haskell is quite multi-paradigm but only the FP side comes close enough to Haskell's "purity" as to make a community translation. I'd be quite willing to say that Haskell has a fantastically correct if slightly difficult to use object system.

It just doesn't quack anything at all like Smalltalk or Java's.


I strongly disagree, but am sure that that disagreement comes only from us defining terms differently. If you define the term "imperative" widely enough to include Haskell, what language does it not include?


I wouldn't claim it excludes many languages. Prolog comes to mind.

Imperative, to me, means a language structured over the execution of statements in order. I think that's a fairly common definition.


That still sounds a little weak, but even under that definition, how does Haskell qualify? Do-notation may make things look like statements, but they are still expressions!


They are statements in an embedded language modeled by the monad. The distinction isn't great. Monad allows the implementer to capture linear action if they like. That makes them at least powerful enough to embed Algol.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: