an observation about Haskell vs. Python

Thanks. I'm okay with the status quo.. I just see it as a tradeoff. You are
giving up something to get something. In Python you give up any kind of
compile-time type checking, you give up the safety of immutable data, and
you get a whole lot of automatic type conversions and brief ways to express
certain algorithms. 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)
On Wed, Sep 19, 2012 at 7:43 PM, Ertugrul Söylemez
Notice: You probably forgot to apply `sin' to an argument.
However, I think that no work is done on that, and there is another possible path: An average Haskell tutorial should always include a section on understanding error messages. In fact the latest issue of The Monad Reader [1] has an article on that by Jan Stolarek.
[1]: http://themonadreader.files.wordpress.com/2012/08/issue20.pdf
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.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

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.

On Thu, Sep 20, 2012 at 10:33 AM, 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.
It's an interesting observation you made earlier, thanks!
I'd also add that the gnarlier errors are because of code maxing out the
newer innovations of the type system. Haskell98, comparatively, isn't half
as terrifying.
But type safety is a drug. You never get enough of it.
One way to contain the complexity is to note what packages viralize their
pragmas, i.e. require client code to turn on the same pragmas that they do.
-- Kim-Ee
On Thu, Sep 20, 2012 at 10:33 AM, Dennis Raddle
Thanks. I'm okay with the status quo.. I just see it as a tradeoff. You are giving up something to get something. In Python you give up any kind of compile-time type checking, you give up the safety of immutable data, and you get a whole lot of automatic type conversions and brief ways to express certain algorithms. 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)
On Wed, Sep 19, 2012 at 7:43 PM, Ertugrul Söylemez
wrote: Notice: You probably forgot to apply `sin' to an argument.
However, I think that no work is done on that, and there is another possible path: An average Haskell tutorial should always include a section on understanding error messages. In fact the latest issue of The Monad Reader [1] has an article on that by Jan Stolarek.
[1]: http://themonadreader.files.wordpress.com/2012/08/issue20.pdf
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.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Dennis Raddle
-
Ertugrul Söylemez
-
Kim-Ee Yeoh