File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ The `Control.Monad.Aff.AVar` module contains asynchronous variables, which
212
212
are very similar to Haskell's ` MVar ` .
213
213
214
214
` AVar ` s represent a value that is either full or empty. Calling ` takeVar ` on
215
- an empty ` AVar ` will queue until it is filled by a matching ` putVar ` .
215
+ an empty ` AVar ` will queue until it is filled by a ` putVar ` .
216
216
217
217
``` purescript
218
218
example = do
@@ -230,22 +230,23 @@ example = do
230
230
> Got a value: hello
231
231
```
232
232
233
- Likewise, calling ` putVar ` will queue until it is taken:
233
+ Likewise, calling ` putVar ` on a filled ` AVar ` will queue until it is emptied by
234
+ a ` takeVar ` .
234
235
235
236
``` purescript
236
237
example = do
237
- var <- makeEmptyVar
238
+ var <- makeVar "hello"
238
239
_ <- forkAff do
239
240
delay (Milliseconds 100.0)
240
241
value <- takeVar var
241
242
log $ "Got a value: " <> value
242
- putVar var "hello "
243
- log "Value taken "
243
+ putVar var "next "
244
+ log "Value put "
244
245
```
245
246
```
246
247
(Waits 100ms)
247
- > Value taken
248
248
> Got a value: hello
249
+ > Value put
249
250
```
250
251
251
252
These combinators (and a few more) can be used as the building blocks for
You can’t perform that action at this time.
0 commit comments