Hello All,

I just saw somewhere that one of the purposes of monads is to capture
side effects. I understand what a side effect is in C, for example. Say
you want to switch the contents of two variables. Then you need a third
temporary variable to store an intermediate result. If this is global,
then it will be changed by the operation. 
But what is a side effect in an fp language like Haskell?
As a follow up, I understand why an IO action like getLine or getChar is
not a function; its results can be different for different calls. But
why not have something like getChar c or getLine str? The types of c or
str are pretty clear, aren't they?
Just something that's been puzzling me for some time now...thanks.

Regards,

Hans van Thiel

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to