News for hackers. Stuff that matters.
Re:Even pure functions have side-effects by scottdw2 on Tuesday September 06, 2011 @07:34PM (#2967714)
Yes, but they usually use some form of monad to hold either an exception or a value.

The implementation of >>= (haskell calls it bind, buts it's useful to think of it like an overloaded ";" that takes a continuation as a parameter ) examines the return value and decided wether to run the normal path or the exception path...

It doesn't quite perform the same as exceptions do (it burdens both paths with if checks, whereas imperative exceptions only burden the error path)

But the code you write looks almost identical to exception handling code. It doesn't look like something using if checks.

There are no comments on this comment yet.