We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
guard
1 parent 7447320 commit 6d17c01Copy full SHA for 6d17c01
src/Control/MonadZero.purs
@@ -39,14 +39,17 @@ instance monadZeroArray :: MonadZero Array
39
-- | For example:
40
-- |
41
-- | ```purescript
42
--- | import Data.Array
+-- | import Prelude
43
+-- | import Control.Monad (bind)
44
+-- | import Control.MonadZero (guard)
45
+-- | import Data.Array ((..))
46
--- | factors :: Number -> Array Number
47
+-- | factors :: Int -> Array Int
48
-- | factors n = do
--- | a <- 1 .. n
--- | b <- 1 .. a
49
+-- | a <- 1..n
50
+-- | b <- a..n
51
-- | guard $ a * b == n
--- | pure a
52
+-- | pure [a, b]
53
-- | ```
54
guard :: forall m. MonadZero m => Boolean -> m Unit
55
guard true = pure unit
0 commit comments