throwIO :: Exception e => e -> IO a
base Control.Exception.Base, base Control.Exception, base Control.OldException
A variant of throw that can only be used within the IO monad. Although throwIO has a type that is an instance of the type of throw, the two functions are subtly different: > throw e `seq` x ===> throw e > throwIO e `seq` x ===> x The first example will cause the exception e to be raised, whereas the second one won't. In fact, throwIO will only cause an exception to be raised when it is used within the IO monad. The throwIO variant should be used in preference to throw to raise an exception within the IO monad because it guarantees ordering with respect to other IO operations, whereas throw does not.