Converting IO Int to Int

As a general rule you write something like this: do x <- somethingThatReturnsIO somethingElseThatReturnsIO $ pureFunction x There is no way to get the “Int” out of an “IO Int”, except to do something else in the IO Monad. In monad terms, the above code desugars into somethingThatReturnsIO >>= (\x -> somethingElseThatReturnsIO $ pureFunction x) … Read more