Skip to content

Commit 84ab8ae

Browse files
Implemented MonadST Aff (#213)
1 parent 2d44d9f commit 84ab8ae

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
77
Breaking changes:
88

99
New features:
10+
- MonadST instance for Aff
1011

1112
Bugfixes:
1213

packages.dhall

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
let upstream =
2-
https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall
2+
https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20220725/packages.dhall
3+
sha256:e56fbdf33a5afd2a610c81f8b940b413a638931edb41532164e641bb2a9ec29c
34

45
in upstream

spago.dhall

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
, "partial"
1919
, "prelude"
2020
, "refs"
21+
, "st"
2122
, "tailrec"
2223
, "transformers"
2324
, "unsafe-coerce"

src/Effect/Aff.purs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import Control.Lazy (class Lazy)
4040
import Control.Monad.Error.Class (class MonadError, class MonadThrow, throwError, catchError, try)
4141
import Control.Monad.Error.Class (try, throwError, catchError) as Exports
4242
import Control.Monad.Rec.Class (class MonadRec, Step(..))
43+
import Control.Monad.ST.Class (class MonadST, liftST)
44+
import Control.Monad.ST.Global (Global)
4345
import Control.Parallel (parSequence_, parallel)
4446
import Control.Parallel.Class (class Parallel)
4547
import Control.Parallel.Class (sequential, parallel) as Exports
@@ -115,6 +117,9 @@ instance monadEffectAff :: MonadEffect Aff where
115117
instance lazyAff :: Lazy (Aff a) where
116118
defer f = pure unit >>= f
117119

120+
instance monadSTAff :: MonadST Global Aff where
121+
liftST = liftST >>> liftEffect
122+
118123
-- | Applicative for running parallel effects. Any `Aff` can be coerced to a
119124
-- | `ParAff` and back using the `Parallel` class.
120125
foreign import data ParAff :: Type -> Type

0 commit comments

Comments
 (0)