News for hackers. Stuff that matters.
Re:Why the world needs Haskell by tmoertel on Wednesday July 10, 2013 @10:38AM (#6019939)
Actually, every function in Haskell is pure. It's just that some of those pure functions produce values of type (IO a) representing IO actions and, if you sequence those actions into the main action (or a subthread's action), those actions will be performed by the runtime.

So when people say that some functions in Haskell are "impure" they mean that they produce IO actions that, if sequenced, will depend upon or cause IO effects. Thus, both

    map print ["hello","world","!"] :: [IO ()]
and

    mapM_ print ["hello","world","!"] :: IO ()
are equally pure or impure: They both produce actions that have side effects if sequenced. It's just that the first must be sequenced differently than the second since it produces a list of actions and not a singleton action. Since singletons can be sequenced with (>>) and (>>=) you can insert them directly into do notation, which makes many people believe that they are somehow different in terms of purity. (But they are not.)
Re:Why the world needs Haskell by chongli on Wednesday July 10, 2013 @10:41AM (#6019968)
That's what I said.
Re:Why the world needs Haskell by tmoertel on Wednesday July 10, 2013 @10:50AM (#6020056)
I wasn't contradicting you but trying to reinforce the point that there's an equivalence between "impure" functions and pure functions that produce actions (having impure effects if sequenced). In particular, I wanted to highlight that (mapM_ print) is not somehow more impure than (map print). Many people seem to believe that it is.
Re:Why the world needs Haskell by chongli on Wednesday July 10, 2013 @10:54AM (#6020098)
Indeed. The source code of mapM_ is literally:

   mapM_ f as      =  sequence_ (map f as)