Skip to content

Commit aaa6fe6

Browse files
committed
Simplify the ifM' docstring and remove superfluous operators
1 parent 7e6baad commit aaa6fe6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Control/Bind.purs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ ifM :: forall a m. Bind m => m Boolean -> m a -> m a -> m a
151151
ifM cond t f = cond >>= \cond' -> if cond' then t else f
152152

153153
-- | Similar to `ifM` but for use in cases where one of the monadic actions may
154-
-- | be expensive to compute. As PureScript is not lazy, the standard `ifM` has
155-
-- | to construct both monadic actions before returning the result, whereas here
156-
-- | only the corresponding monadic action is constructed.
154+
-- | be expensive to construct.
157155
-- |
158156
-- | ```purescript
159157
-- | main :: Effect Unit

src/Control/Monad.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ whenM mb m = ifM mb m $ pure unit
6565
-- | Perform a monadic action lazily when a condition is true, where the conditional
6666
-- | value is also in a monadic context.
6767
whenM' :: forall m a. Monad m => (a -> m Boolean) -> (a -> m Unit) -> a -> m Unit
68-
whenM' mb m = ifM' mb m $ \_ -> pure unit
68+
whenM' mb m = ifM' mb m \_ -> pure unit
6969

7070
-- | Perform a monadic action unless a condition is true, where the conditional
7171
-- | value is also in a monadic context.
@@ -75,7 +75,7 @@ unlessM mb = whenM $ not <$> mb
7575
-- | Perform a monadic action lazily unless a condition is true, where the conditional
7676
-- | value is also in a monadic context.
7777
unlessM' :: forall m a. Monad m => (a -> m Boolean) -> (a -> m Unit) -> a -> m Unit
78-
unlessM' mb = whenM' $ \x -> mb x >>= not >>> pure
78+
unlessM' mb = whenM' \x -> mb x >>= not >>> pure
7979

8080
-- | `ap` provides a default implementation of `(<*>)` for any `Monad`, without
8181
-- | using `(<*>)` as provided by the `Apply`-`Monad` superclass relationship.

0 commit comments

Comments
 (0)