You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,21 +171,19 @@ canceled <- canceler $ error "Just had to cancel"
171
171
_ <- liftEff $ if canceled then (trace "Canceled") else (trace "Not Canceled")
172
172
```
173
173
174
-
## Queues
174
+
## AVars
175
175
176
-
The `Control.Monad.Aff.Queue` module contains asynchronous queues. These can
177
-
be used as low-level building blocks for asynchronous programs.
176
+
The `Control.Monad.Aff.AVar` module contains asynchronous variables, which are very similar to Haskell's `MVar` construct. These can be used as low-level building blocks for asynchronous programs.
178
177
179
178
```purescript
180
-
do v <- makeQueue
181
-
forkAff (later $ putQueue v 1.0)
182
-
a <- takeQueue v
179
+
do v <- makeVar
180
+
forkAff (later $ putVar v 1.0)
181
+
a <- takeVar v
183
182
liftEff $ trace ("Succeeded with " ++ show a)
184
183
```
185
184
186
185
You can use these constructs as one-sided blocking queues, which suspend (if
187
-
necessary) on `take` operations, or as asynchronous variables (similar to
188
-
Haskell's `MVar` construct).
186
+
necessary) on `take` operations, or as asynchronous, empty-or-full variables.
0 commit comments