projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
20e2625
)
Add allM and anyM functions.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Wed, 7 Apr 2010 12:15:22 +0000
(14:15 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Wed, 7 Apr 2010 12:15:22 +0000
(14:15 +0200)
cλash/CLasH/Utils.hs
patch
|
blob
|
history
diff --git
a/cλash/CLasH/Utils.hs
b/cλash/CLasH/Utils.hs
index 41d7beee98a635083b2ad0c66d7aedbfc9403c46..2966757a038b1d2fefd6a9db51547a0bcf8d0bff 100644
(file)
--- a/
cλash/CLasH/Utils.hs
+++ b/
cλash/CLasH/Utils.hs
@@
-48,6
+48,12
@@
andM, orM :: (Monad m) => m [Bool] -> m Bool
andM = Monad.liftM and
orM = Monad.liftM or
+-- | Monadic versions of any and all. We reimplement them, since there
+-- is no ready-made lifting function for them.
+allM, anyM :: (Monad m) => (a -> m Bool) -> [a] -> m Bool
+allM f = andM . (mapM f)
+anyM f = orM . (mapM f)
+
mapAccumLM :: (Monad m) => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
mapAccumLM _ s [] = return (s, [])
mapAccumLM f s (x:xs) = do