@@ -25,10 +25,10 @@ import Prelude
2525import Control.Alt (class Alt )
2626import Control.Alternative (class Alternative )
2727import Control.Monad.Aff.Internal (AVBox , AVar , _killVar , _putVar , _takeVar , _makeVar )
28- import Control.Monad.Eff (Eff )
28+ import Control.Monad.Eff (Eff , kind Effect )
2929import Control.Monad.Eff.Class (class MonadEff )
3030import Control.Monad.Eff.Exception (Error , EXCEPTION , throwException , error )
31- import Control.Monad.Error.Class (class MonadError , throwError )
31+ import Control.Monad.Error.Class (class MonadThrow , class MonadError , throwError )
3232import Control.Monad.Rec.Class (class MonadRec , Step (..))
3333import Control.MonadPlus (class MonadZero , class MonadPlus )
3434import Control.Parallel (class Parallel )
@@ -47,7 +47,7 @@ import Unsafe.Coerce (unsafeCoerce)
4747-- | errors or produces a value of type `a`.
4848-- |
4949-- | This is moral equivalent of `ErrorT (ContT Unit (Eff e)) a`.
50- foreign import data Aff :: # ! -> * -> *
50+ foreign import data Aff :: # Effect -> Type -> Type
5151
5252-- | A pure asynchronous computation, having no effects other than
5353-- | asynchronous computation.
@@ -80,12 +80,12 @@ cancelWith aff c = runFn3 _cancelWith nonCanceler aff c
8080-- | If you do need to handle exceptions, you can use `runAff` instead, or
8181-- | you can handle the exception within the Aff computation, using
8282-- | `catchError` (or any of the other mechanisms).
83- launchAff :: forall e a . Aff e a -> Eff (err :: EXCEPTION | e ) (Canceler e )
83+ launchAff :: forall e a . Aff e a -> Eff (exception :: EXCEPTION | e ) (Canceler e )
8484launchAff = lowerEx <<< runAff throwException (const (pure unit)) <<< liftEx
8585 where
86- liftEx :: Aff e a -> Aff (err :: EXCEPTION | e ) a
86+ liftEx :: Aff e a -> Aff (exception :: EXCEPTION | e ) a
8787 liftEx = _unsafeInterleaveAff
88- lowerEx :: Eff (err :: EXCEPTION | e ) (Canceler (err :: EXCEPTION | e )) -> Eff (err :: EXCEPTION | e ) (Canceler e )
88+ lowerEx :: Eff (exception :: EXCEPTION | e ) (Canceler (exception :: EXCEPTION | e )) -> Eff (exception :: EXCEPTION | e ) (Canceler e )
8989 lowerEx = map (Canceler <<< map _unsafeInterleaveAff <<< cancel )
9090
9191-- | Runs the asynchronous computation. You must supply an error callback and a
@@ -149,7 +149,7 @@ apathize :: forall e a. Aff e a -> Aff e Unit
149149apathize a = const unit <$> attempt a
150150
151151-- | Lifts a synchronous computation and makes explicit any failure from exceptions.
152- liftEff' :: forall e a . Eff (err :: EXCEPTION | e ) a -> Aff e (Either Error a )
152+ liftEff' :: forall e a . Eff (exception :: EXCEPTION | e ) a -> Aff e (Either Error a )
153153liftEff' eff = attempt (_unsafeInterleaveAff (runFn2 _liftEff nonCanceler eff))
154154
155155-- | A constant canceller that always returns false.
@@ -183,11 +183,14 @@ instance monadAff :: Monad (Aff e)
183183instance monadEffAff :: MonadEff e (Aff e ) where
184184 liftEff eff = runFn2 _liftEff nonCanceler eff
185185
186- -- | Allows users to catch and throw errors on the error channel of the
186+ -- | Allows users to throw errors on the error channel of the
187187-- | asynchronous computation. See documentation in `purescript-transformers`.
188- instance monadErrorAff :: MonadError Error (Aff e ) where
188+ instance monadThrowAff :: MonadThrow Error (Aff e ) where
189189 throwError e = runFn2 _throwError nonCanceler e
190190
191+ -- | Allows users to catch errors on the error channel of the
192+ -- | asynchronous computation. See documentation in `purescript-transformers`.
193+ instance monadErrorAff :: MonadError Error (Aff e ) where
191194 catchError aff ex = attempt aff >>= either ex pure
192195
193196instance altAff :: Alt (Aff e ) where
0 commit comments