Skip to content

Commit 6d17c01

Browse files
JamieWohletzpaf31
authored andcommitted
Update docs for guard (#36)
* Update docs for guard * add imports to guard docs * remove additional description
1 parent 7447320 commit 6d17c01

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Control/MonadZero.purs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ instance monadZeroArray :: MonadZero Array
3939
-- | For example:
4040
-- |
4141
-- | ```purescript
42-
-- | import Data.Array
42+
-- | import Prelude
43+
-- | import Control.Monad (bind)
44+
-- | import Control.MonadZero (guard)
45+
-- | import Data.Array ((..))
4346
-- |
44-
-- | factors :: Number -> Array Number
47+
-- | factors :: Int -> Array Int
4548
-- | factors n = do
46-
-- | a <- 1 .. n
47-
-- | b <- 1 .. a
49+
-- | a <- 1..n
50+
-- | b <- a..n
4851
-- | guard $ a * b == n
49-
-- | pure a
52+
-- | pure [a, b]
5053
-- | ```
5154
guard :: forall m. MonadZero m => Boolean -> m Unit
5255
guard true = pure unit

0 commit comments

Comments
 (0)