Assertion in IO monad

Henning Thielemann lemming at
Thu Feb 24 01:15:02 CET 2011

On Thu, 24 Feb 2011, Mitar wrote:

> In Haskell there is difference between throw and throwIO. Because of
> that I searched for a way to assure ordering in a similar manner of my
> assertions. But I have not found any. Wouldn't it be useful to have
> also assertIO counterpart of assert?
> I would propose "Bool -> IO ()" type.

'throw' is for exception handling, 'assert' is for debugging. What do you 
intend to use 'assert' for? 'assert' is not a combination of 'if' and 
'throw'. It can be disabled by a GHC flag, if you think you do not need 
debugging anymore.

More information about the Libraries mailing list