Skip to content

Commit ee77f86

Browse files
committed
more tests
1 parent 100029c commit ee77f86

File tree

2 files changed

+211
-32
lines changed

2 files changed

+211
-32
lines changed

examples/src/Examples.purs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
module Examples where
2+
import Debug.Trace(trace, Trace())
3+
4+
import Data.Either(either)
5+
26
import Control.Monad.Aff
37
import Control.Monad.Eff.Class(liftEff)
4-
import Debug.Trace
5-
8+
import Control.Monad.Eff.Exception(error)
9+
import Control.Monad.Error.Class(throwError)
10+
611
foreign import data Time :: !
712

813
foreign import timeout """
@@ -29,6 +34,19 @@ module Examples where
2934
liftEff $ trace (show n ++ " seconds left")
3035
test_sequencing (n - 1)
3136

37+
test_attempt :: forall e. Aff (trace :: Trace | e) Unit
38+
test_attempt = do
39+
e <- attempt (throwError (error "Oh noes!"))
40+
liftEff $ either (const $ trace "Exception caught") (const $ trace "Exception NOT caught!!!") e
41+
3242
main = launchAff $ do
3343
liftEff $ trace "Testing sequencing"
34-
test_sequencing 10
44+
test_sequencing 3
45+
46+
liftEff $ trace "Testing attempt"
47+
test_attempt
48+
49+
liftEff $ trace "Testing later"
50+
later $ liftEff $ trace "It happend later"
51+
52+

0 commit comments

Comments
 (0)