[project @ 2003-06-03 22:26:44 by diatchki]
[ghc-base.git] / Control / Monad / X / tests / Error.hs
1 import Control.Monad.X.Error
2
3
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)
9
10
11 test m e  = runError m == e
12
13 main  = print $ and [t1,t2,t3,t4,t5]
14