[Haskell-cafe] On the purity of Haskell

Steve Horne sh006d3592 at blueyonder.co.uk
Thu Dec 29 03:53:50 CET 2011


On 29/12/2011 00:57, Thiago Negri wrote:
>
> We can do functional programming on Java. We use all the design
> patterns for that.
>
> At the very end, everything is just some noisy, hairy,
> side-effectfull, gotofull machinery code.
>
> The beauty of Haskell is that it allows you to limit the things you
> need to reason about. If I see a function with the type "(a, b) -> a"
> I don't need to read a man page to see where I should use it or not. I
> know what it can do by its type. In C I can not do this. What can I
> say about a function "int foo(char* bar)"? Does it allocate memory?
> Does it asks a number for the user on stdin? Or does it returns the
> length of a zero-ending char sequence? In fact it can do anything, and
> I can't forbid that. I can't guarantee that my function has good
> behaviour. You need to trust the man page.
>
Well, I did say (an unoriginal point) that "The IO monad is explicit in 
Haskell - side-effects are only permitted (even at run-time) where the 
programmer has explicitly opted to allow them.". So yes.

The "it could do anything!!!" claims are over the top and IMO 
counterproductive, though. The type system doesn't help the way it does 
in Haskell, but nevertheless, plenty of people reason about the 
side-effects in C mostly-successfully.

Mostly /= always, but bugs can occur in any language.



More information about the Haskell-Cafe mailing list