Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
],
"license": "MIT",
"dependencies": {
"purescript-eff": "~0.1.0",
"purescript-prelude": "~0.1.1"
"purescript-eff": "^3.0.0",
"purescript-prelude": "^3.0.0"
},
"repository": {
"type": "git",
Expand All @@ -33,8 +33,8 @@
"package.json"
],
"devDependencies": {
"purescript-console": "~0.1.0",
"purescript-exceptions": "~0.3.0",
"purescript-spec": "~0.7.1"
"purescript-console": "^3.0.0",
"purescript-exceptions": "^3.0.0",
"purescript-spec": "^2.0.0"
}
}
9 changes: 5 additions & 4 deletions src/Control/Monad/Eff/Timer.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
module Control.Monad.Eff.Timer where

import Prelude
import Control.Monad.Eff

foreign import data TIMER :: !
foreign import data Timeout :: *
foreign import data Interval :: *
import Control.Monad.Eff (Eff, kind Effect)

foreign import data TIMER :: Effect
foreign import data Timeout :: Type
foreign import data Interval :: Type

type Milliseconds = Int

Expand Down
26 changes: 13 additions & 13 deletions test/Test.Main.purs
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module Test.Main where

import Prelude
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Console (print, CONSOLE())
import Control.Monad.Eff.Exception (throwException, error, EXCEPTION())
import Control.Monad.Eff.Timer
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (logShow, CONSOLE)
import Control.Monad.Eff.Exception (throwException, error, EXCEPTION)
import Control.Monad.Eff.Timer (TIMER, clearInterval, clearTimeout, delay, interval, timeout)

main :: forall eff. Eff (console :: CONSOLE, timer :: TIMER, err :: EXCEPTION | eff) Unit
main :: forall eff. Eff (console :: CONSOLE, timer :: TIMER, exception :: EXCEPTION | eff) Unit
main = do
print 1
logShow 1
a <- timeout 10 $ do
print 4
print 2
delay 20 print 5
print 3
logShow 4
logShow 2
_ <- delay 20 logShow 5
logShow 3
b <- interval 30 $ do
print 6
delay 40 clearInterval b
logShow 6
_ <- delay 40 clearInterval b
c <- timeout 0 $ throwException $ do
error "clearTimeout is not working"
clearTimeout c
d <- interval 0 $ throwException $ do
error "clearInterval is not working"
clearInterval d
return unit
pure unit