From f93598fac92967db9e29c2f885aeb88aa83cdaa5 Mon Sep 17 00:00:00 2001 From: Jorge Acereda Date: Thu, 11 Jan 2018 09:23:36 +0100 Subject: [PATCH] Updates for 0.11 --- bower.json | 10 +++++----- src/Control/Monad/Eff/Timer.purs | 9 +++++---- test/Test.Main.purs | 26 +++++++++++++------------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/bower.json b/bower.json index efad4a6..630a578 100644 --- a/bower.json +++ b/bower.json @@ -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", @@ -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" } } diff --git a/src/Control/Monad/Eff/Timer.purs b/src/Control/Monad/Eff/Timer.purs index 0edc046..71f3761 100644 --- a/src/Control/Monad/Eff/Timer.purs +++ b/src/Control/Monad/Eff/Timer.purs @@ -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 diff --git a/test/Test.Main.purs b/test/Test.Main.purs index 84efc52..f71d34a 100644 --- a/test/Test.Main.purs +++ b/test/Test.Main.purs @@ -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