From 629f9b3c1fae437e5b14a2a936a47ab5090e2601 Mon Sep 17 00:00:00 2001 From: rightfold Date: Mon, 24 Apr 2017 11:04:31 +0200 Subject: [PATCH] Update for PureScript 0.11 --- bower.json | 20 ++++++++++---------- src/Control/Monad/IO.purs | 4 +++- src/Control/Monad/IO/Effect.purs | 2 ++ src/Control/Monad/IOSync.purs | 4 +++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index 7ae5ef6..6297c7e 100644 --- a/bower.json +++ b/bower.json @@ -7,17 +7,17 @@ "output" ], "dependencies": { - "purescript-aff": "^2.0.3", - "purescript-control": "^2.0.0", - "purescript-eff": "^2.0.0", - "purescript-exceptions": "^2.0.0", - "purescript-monoid": "^2.2.0", - "purescript-newtype": "^1.3.0", - "purescript-prelude": "^2.5.0", - "purescript-tailrec": "^2.0.2", - "purescript-transformers": "^2.3.0" + "purescript-aff": "^3.0.0", + "purescript-control": "^3.0.0", + "purescript-eff": "^3.1.0", + "purescript-exceptions": "^3.0.0", + "purescript-monoid": "^3.0.0", + "purescript-newtype": "^2.0.0", + "purescript-prelude": "^3.0.0", + "purescript-tailrec": "^3.1.0", + "purescript-transformers": "^3.2.0" }, "devDependencies": { - "purescript-psci-support": "^2.0.0" + "purescript-psci-support": "^3.0.0" } } diff --git a/src/Control/Monad/IO.purs b/src/Control/Monad/IO.purs index 8bc3a15..ed57aec 100644 --- a/src/Control/Monad/IO.purs +++ b/src/Control/Monad/IO.purs @@ -14,7 +14,7 @@ import Control.Monad.Aff.Unsafe (unsafeCoerceAff) import Control.Monad.Eff.Class (class MonadEff, liftEff) import Control.Monad.Eff.Exception (Error) import Control.Monad.Eff.Unsafe (unsafeCoerceEff) -import Control.Monad.Error.Class (class MonadError) +import Control.Monad.Error.Class (class MonadError, class MonadThrow) import Control.Monad.IO.Effect (INFINITY) import Control.Monad.IOSync (IOSync) import Control.Monad.Rec.Class (class MonadRec) @@ -55,6 +55,8 @@ instance monadAffIO :: MonadAff eff IO where instance monadEffIO :: MonadEff eff IO where liftEff = wrap <<< liftEff <<< unsafeCoerceEff +derive newtype instance monadThrowIO :: MonadThrow Error IO + derive newtype instance monadErrorIO :: MonadError Error IO derive newtype instance altIO :: Alt IO diff --git a/src/Control/Monad/IO/Effect.purs b/src/Control/Monad/IO/Effect.purs index 67fe6c9..928946d 100644 --- a/src/Control/Monad/IO/Effect.purs +++ b/src/Control/Monad/IO/Effect.purs @@ -2,4 +2,6 @@ module Control.Monad.IO.Effect ( INFINITY ) where +import Control.Monad.Eff (kind Effect) + foreign import data INFINITY :: Effect diff --git a/src/Control/Monad/IOSync.purs b/src/Control/Monad/IOSync.purs index 7d12fd5..6c638a4 100644 --- a/src/Control/Monad/IOSync.purs +++ b/src/Control/Monad/IOSync.purs @@ -11,7 +11,7 @@ import Control.Monad.Eff (Eff) import Control.Monad.Eff.Class (class MonadEff, liftEff) import Control.Monad.Eff.Exception (Error, catchException, error, throwException) import Control.Monad.Eff.Unsafe (unsafeCoerceEff) -import Control.Monad.Error.Class (class MonadError, catchError, throwError) +import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, throwError) import Control.Monad.IO.Effect (INFINITY) import Control.Monad.Rec.Class (class MonadRec) import Control.MonadZero (class MonadZero) @@ -50,6 +50,8 @@ instance monadEffIOSync :: MonadEff eff IOSync where instance monadErrorIOSync :: MonadError Error IOSync where catchError a k = liftEff $ catchException (\e -> unwrap $ k e) (unsafeCoerceEff $ unwrap a) + +instance monadThrowIOSync :: MonadThrow Error IOSync where throwError = liftEff <<< throwException instance altIOSync :: Alt IOSync where