|
|
Warp wrote:
> Orchid XP v7 <voi### [at] devnull> wrote:
>> As posted elsewhere, what Warp *really* means is "arrays with in-place
>> update". Which *is* strictly speaking against functional style. (But
>> that doesn't stop you using it even in a pure functional language such
>> as Haskell...)
>
> Well, modifying an array in-place means it's a side-effect, which
> means Haskell is not pure.
For the Nth time: All side-effects are technically outside the language
itself, and hence Haskell is not impure.
For example, in Lisp, if you have a list, usually you update it by
constructing a modified copy. But, if you feel like it, you can just go
"ah well, I can't be bothered" and modify a list (or any other data
structure) in-place. In Haskell, you cannot do this.
[Since you can call C from Haskell, you can tell the compiler "hey, this
C function has no side effects" when actually it does. But there's not
really anything the Haskell language spec can do about that... And if
you try this, Bad Things happen.]
> OTOH, why would that be a bad thing? Just being "pure functional" for
> the sake of being pure is counter-productive.
Remember how in Haskell code executes in arbitrary order?
Now mix that up with side-effects. Go on. See what kind of a mess you
end up with. Hint: it won't be pretty. ;-)
Haskell is able to execute things in arbitrary order (and possibly not
execute things at all, and possibly execute many things in paralle
transparently, and...) precisely *because* it is a pure language. And
that's to say nothing about the optimisation possibilities offered to
the compiler.
You make it sound like purity is just some arcane concept invented by
mathematicians that serves no practical purpose. ;-)
> Trying to avoid it would sometimes be more awkward than
> would be worth.
Sometimes, yes. And this is partly why Haskell offers you a way to
indirectly perform various side-effecting operations such as in-place
array updates (not to mention file I/O etc.)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|