File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,12 @@ unless :: forall m. (Monad m) => Boolean -> m Unit -> m Unit
303
303
filterM :: forall a m. (Monad m) => (a -> m Boolean) -> [a] -> m [a]
304
304
```
305
305
306
+ Filter where the predicate returns a monadic Boolean. For example:
307
+
308
+ ``` purescript
309
+ powerSet :: forall a. [a] -> [[a]]
310
+ powerSet = filterM (const [true, false])
311
+ ```
306
312
307
313
308
314
## Module Control.MonadPlus
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ unless :: forall m. (Monad m) => Boolean -> m Unit -> m Unit
19
19
unless false m = m
20
20
unless true _ = return unit
21
21
22
+ -- | Filter where the predicate returns a monadic Boolean. For example:
23
+ -- |
24
+ -- | ```purescript
25
+ -- | powerSet :: forall a. [a] -> [[a]]
26
+ -- | powerSet = filterM (const [true, false])
27
+ -- | ```
22
28
filterM :: forall a m . (Monad m ) => (a -> m Boolean ) -> [a ] -> m [a ]
23
29
filterM _ [] = return []
24
30
filterM p (x:xs) = do
You can’t perform that action at this time.
0 commit comments