
Dennis Raddle
[...] In Haskell you give up easy-to-comprehend error messages and mutable data, and get back in reward a lot of reassurance that your program does what you meant and expressivity. (I realize Haskell has mutable data but it's not like Python's)
It is actually the same. It's just that the assignment function is not called "=", but instead, say, writeSTRef. You could very well give it an additional name, e.g. "~=": class Mutable m where type Ref m :: * -> * newRef :: a -> m (Ref m a) (~=) :: Ref m a -> a -> m () instance Mutable IO where type Ref IO = IORef newRef = newIORef (~=) = writeIORef main = do x <- newRef 10 x ~= 15 {- ... -} In fact Haskell generalizes this idea, because using lenses you can have something similar even in state monads, which are actually pure and don't use mutable variables. Also I really doubt that there is any algorithm that has a shorter and/or more readable implementation in Python from a language viewpoint. It's really more a matter of what is predefined. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.