File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1616 " bower.json" ,
1717 " Gruntfile.js" ,
1818 " package.json"
19- ]
19+ ],
20+ "dependencies" : {
21+ "purescript-integers" : " ~0.1.0"
22+ }
2023}
Original file line number Diff line number Diff line change 22
33module Control.Monad where
44
5+ import Data.Int (Int ())
6+
57-- | Perform a monadic action `n` times collecting all of the results.
6- replicateM :: forall m a . (Monad m ) => Number -> m a -> m [a ]
7- replicateM 0 _ = return []
8- replicateM n m = do
9- a <- m
10- as <- replicateM (n - 1 ) m
11- return (a : as)
8+ replicateM :: forall m a . (Monad m ) => Int -> m a -> m [a ]
9+ replicateM n m | n == zero = return []
10+ | otherwise = do a <- m
11+ as <- replicateM (n - one) m
12+ return (a : as)
1213
1314-- | Perform a fold using a monadic step function.
1415foldM :: forall m a b . (Monad m ) => (a -> b -> m a ) -> a -> [b ] -> m a
@@ -27,7 +28,7 @@ unless true _ = return unit
2728
2829-- | Filter where the predicate returns a monadic `Boolean`.
2930-- |
30- -- | For example:
31+ -- | For example:
3132-- |
3233-- | ```purescript
3334-- | powerSet :: forall a. [a] -> [[a]]
You can’t perform that action at this time.
0 commit comments