From 4f7e9399f3dc7f7fc8ecb99db47fded8a4dcf8df Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Wed, 22 Nov 2023 09:01:47 -0600 Subject: [PATCH] feat: unliftaff --- spago.yaml | 1 + src/Control.Monad.State.Async.purs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/spago.yaml b/spago.yaml index 54252d6..bdde015 100644 --- a/spago.yaml +++ b/spago.yaml @@ -3,6 +3,7 @@ package: - aff - arrays - avar + - unlift name: sync test: main: Test.Main diff --git a/src/Control.Monad.State.Async.purs b/src/Control.Monad.State.Async.purs index 6a73799..e11de4f 100644 --- a/src/Control.Monad.State.Async.purs +++ b/src/Control.Monad.State.Async.purs @@ -9,6 +9,7 @@ import Control.Monad.Fork.Class (class MonadBracket, class MonadFork, class Mona import Control.Monad.Reader (class MonadAsk, ReaderT(..), ask) import Control.Monad.Rec.Class (class MonadRec) import Control.Monad.Trans.Class (class MonadTrans, lift) +import Control.Monad.Unlift (class MonadUnlift) import Control.Parallel (class Parallel, parallel, sequential) import Data.Async.Class (class AsyncState) import Data.Async.Class as State @@ -20,7 +21,9 @@ import Data.Traversable (for, for_) import Data.Tuple (fst, snd) import Data.Tuple.Nested (type (/\), (/\)) import Effect.Aff.Class (class MonadAff) +import Effect.Aff.Unlift (class MonadUnliftAff) import Effect.Class (class MonadEffect) +import Effect.Unlift (class MonadUnliftEffect) -- | Computations with a mutable value of type `s` that may be evaluated in parallel -- | @@ -172,6 +175,8 @@ derive newtype instance (MonadThrow e m) => MonadThrow e (AsyncStateT w s m) derive newtype instance (MonadError e m) => MonadError e (AsyncStateT w s m) derive newtype instance (MonadFork f m) => MonadFork f (AsyncStateT w s m) derive newtype instance (MonadRec m) => MonadRec (AsyncStateT w s m) +derive newtype instance (MonadUnliftAff m) => MonadUnliftAff (AsyncStateT w s m) +derive newtype instance (MonadUnliftEffect m) => MonadUnliftEffect (AsyncStateT w s m) instance (Parallel f m) => Parallel (AsyncStateT w s f) (AsyncStateT w s m) where parallel a = wrap $ parallel $ unwrap a sequential a = wrap $ sequential $ unwrap a