1 import Control.Monad.X.Error
4 t1 = test (throwError "x") (Left "x" :: Either String Int)
5 t2 = test (throwError "x" >>= undefined) (Left "x" :: Either String Int)
6 t3 = test (throwError "x" `catchError` return) (Right "x")
7 t4 = test (throwError "x" `catchError` throwError) (Left "x" :: Either String Int)
8 t5 = test (return 3 `catchError` undefined) (Right 3:: Either String Int)
11 test m e = runError m == e
13 main = print $ and [t1,t2,t3,t4,t5]