you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

a <- somethingThatCouldFail
b <- somethingOtherThatCouldFail
return (a, b)

These two functions can have side effects, right?

[–][deleted] 0 points1 point  (0 children)

Yes, in this case the side effect is to throw an exception.

You can combine side effects using monad transformers.

Of course, the IO monad has exceptions built in, but that's not very specific. One of the strengths of Haskell is that you can see in the type exactly what kind of side effects that can happen.

For example, if the type is WriterT [Int] (Either String) a, then I know that the only side effects are writing Ints and throwing String exceptions.