Skip to content

Commit 486c574

Browse files
committed
update docs
1 parent 46951cf commit 486c574

File tree

1 file changed

+78
-62
lines changed

1 file changed

+78
-62
lines changed

MODULES.md

Lines changed: 78 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ type PureAff a = forall e. Aff e a
2121

2222
A pure asynchronous computation, having no effects.
2323

24+
#### `Canceler`
25+
26+
``` purescript
27+
type Canceler e = Error -> Aff e Boolean
28+
```
29+
30+
2431
#### `launchAff`
2532

2633
``` purescript
@@ -46,7 +53,8 @@ makeAff :: forall e a. ((Error -> Eff e Unit) -> (a -> Eff e Unit) -> Eff e Unit
4653
```
4754

4855
Creates an asynchronous effect from a function that accepts error and
49-
success callbacks.
56+
success callbacks. This function can be used for asynchronous computations
57+
that cannot be canceled.
5058

5159
#### `later`
5260

@@ -67,7 +75,7 @@ Runs the asynchronous computation later (off the current execution context).
6775
#### `forkAff`
6876

6977
``` purescript
70-
forkAff :: forall e a. Aff e a -> Aff e Unit
78+
forkAff :: forall e a. Aff e a -> Aff e (Canceler e)
7179
```
7280

7381
Forks the specified asynchronous computation so subsequent monadic binds
@@ -97,6 +105,14 @@ liftEff' :: forall e a. Eff (err :: Exception | e) a -> Aff e (Either Error a)
97105

98106
Lifts a synchronous computation and makes explicit any failure from exceptions.
99107

108+
#### `nonCanceler`
109+
110+
``` purescript
111+
nonCanceler :: forall e. Canceler e
112+
```
113+
114+
A constant function that always returns a pure false value.
115+
100116
#### `semigroupAff`
101117

102118
``` purescript
@@ -191,171 +207,171 @@ instance monadPlusAff :: MonadPlus (Aff e)
191207

192208

193209

194-
## Module Control.Monad.Aff.Class
210+
## Module Control.Monad.Aff.AVar
195211

196-
#### `MonadAff`
212+
#### `AVAR`
197213

198214
``` purescript
199-
class MonadAff e m where
200-
liftAff :: forall a. Aff e a -> m a
215+
data AVAR :: !
201216
```
202217

203218

204-
#### `monadAffAff`
219+
#### `AVar`
205220

206221
``` purescript
207-
instance monadAffAff :: MonadAff e (Aff e)
222+
data AVar :: * -> *
208223
```
209224

210225

211-
212-
## Module Control.Monad.Aff.Par
213-
214-
#### `Par`
226+
#### `AffAVar`
215227

216228
``` purescript
217-
newtype Par e a
218-
= Par (AffQueue e a)
229+
type AffAVar e a = Aff (avar :: AVAR | e) a
219230
```
220231

221232

222-
#### `runPar`
233+
#### `makeVar`
223234

224235
``` purescript
225-
runPar :: forall e a. Par e a -> AffQueue e a
236+
makeVar :: forall e a. AffAVar e (AVar a)
226237
```
227238

228-
Extracts the `Aff` from the `Par`.
239+
Makes a new asynchronous avar.
229240

230-
#### `semigroupPar`
241+
#### `makeVar'`
231242

232243
``` purescript
233-
instance semigroupPar :: (Semigroup a) => Semigroup (Par e a)
244+
makeVar' :: forall e a. a -> AffAVar e (AVar a)
234245
```
235246

247+
Makes a avar and sets it to some value.
236248

237-
#### `monoidPar`
249+
#### `takeVar`
238250

239251
``` purescript
240-
instance monoidPar :: (Monoid a) => Monoid (Par e a)
252+
takeVar :: forall e a. AVar a -> AffAVar e a
241253
```
242254

255+
Takes the next value from the asynchronous avar.
243256

244-
#### `functorPar`
257+
#### `putVar`
245258

246259
``` purescript
247-
instance functorPar :: Functor (Par e)
260+
putVar :: forall e a. AVar a -> a -> AffAVar e Unit
248261
```
249262

263+
Puts a new value into the asynchronous avar. If the avar has
264+
been killed, this will result in an error.
250265

251-
#### `applyPar`
266+
#### `modifyVar`
252267

253268
``` purescript
254-
instance applyPar :: Apply (Par e)
269+
modifyVar :: forall e a. (a -> a) -> AVar a -> AffAVar e Unit
255270
```
256271

272+
Modifies the value at the head of the avar (will suspend until one is available).
257273

258-
#### `applicativePar`
274+
#### `killVar`
259275

260276
``` purescript
261-
instance applicativePar :: Applicative (Par e)
277+
killVar :: forall e a. AVar a -> Error -> AffAVar e Unit
262278
```
263279

280+
Kills an asynchronous avar.
264281

265-
#### `altPar`
282+
283+
## Module Control.Monad.Aff.Class
284+
285+
#### `MonadAff`
266286

267287
``` purescript
268-
instance altPar :: Alt (Par e)
288+
class MonadAff e m where
289+
liftAff :: forall a. Aff e a -> m a
269290
```
270291

271-
Returns the first value, or the first error if both error.
272292

273-
#### `plusPar`
293+
#### `monadAffAff`
274294

275295
``` purescript
276-
instance plusPar :: Plus (Par e)
296+
instance monadAffAff :: MonadAff e (Aff e)
277297
```
278298

279299

280-
#### `alternativePar`
281300

282-
``` purescript
283-
instance alternativePar :: Alternative (Par e)
284-
```
301+
## Module Control.Monad.Aff.Par
285302

303+
#### `Par`
286304

305+
``` purescript
306+
newtype Par e a
307+
= Par (AffAVar e a)
308+
```
287309

288-
## Module Control.Monad.Aff.Queue
289310

290-
#### `QueueFx`
311+
#### `runPar`
291312

292313
``` purescript
293-
data QueueFx :: !
314+
runPar :: forall e a. Par e a -> AffAVar e a
294315
```
295316

317+
Extracts the `Aff` from the `Par`.
296318

297-
#### `Queue`
319+
#### `semigroupPar`
298320

299321
``` purescript
300-
data Queue :: * -> *
322+
instance semigroupPar :: (Semigroup a) => Semigroup (Par e a)
301323
```
302324

303325

304-
#### `AffQueue`
326+
#### `monoidPar`
305327

306328
``` purescript
307-
type AffQueue e a = Aff (queue :: QueueFx | e) a
329+
instance monoidPar :: (Monoid a) => Monoid (Par e a)
308330
```
309331

310332

311-
#### `makeQueue`
333+
#### `functorPar`
312334

313335
``` purescript
314-
makeQueue :: forall e a. AffQueue e (Queue a)
336+
instance functorPar :: Functor (Par e)
315337
```
316338

317-
Makes a new asynchronous queue.
318339

319-
#### `makeQueue'`
340+
#### `applyPar`
320341

321342
``` purescript
322-
makeQueue' :: forall e a. a -> AffQueue e (Queue a)
343+
instance applyPar :: Apply (Par e)
323344
```
324345

325-
Makes a queue and sets it to some value.
326346

327-
#### `takeQueue`
347+
#### `applicativePar`
328348

329349
``` purescript
330-
takeQueue :: forall e a. Queue a -> AffQueue e a
350+
instance applicativePar :: Applicative (Par e)
331351
```
332352

333-
Takes the next value from the asynchronous queue.
334353

335-
#### `putQueue`
354+
#### `altPar`
336355

337356
``` purescript
338-
putQueue :: forall e a. Queue a -> a -> AffQueue e Unit
357+
instance altPar :: Alt (Par e)
339358
```
340359

341-
Puts a new value into the asynchronous queue. If the queue has
342-
been killed, this will result in an error.
360+
Returns the first value, or the first error if both error.
343361

344-
#### `modifyQueue`
362+
#### `plusPar`
345363

346364
``` purescript
347-
modifyQueue :: forall e a. (a -> a) -> Queue a -> AffQueue e Unit
365+
instance plusPar :: Plus (Par e)
348366
```
349367

350-
Modifies the value at the head of the queue (will suspend until one is available).
351368

352-
#### `killQueue`
369+
#### `alternativePar`
353370

354371
``` purescript
355-
killQueue :: forall e a. Queue a -> Error -> AffQueue e Unit
372+
instance alternativePar :: Alternative (Par e)
356373
```
357374

358-
Kills an asynchronous queue.
359375

360376

361377
## Module Control.Monad.Aff.Unsafe

0 commit comments

Comments
 (0)