diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2022-11-08 21:30:20 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-11-10 22:13:37 +0100 |
commit | 1ebc50bdec3ac4417e8c3eaaef816bfa64f59315 (patch) | |
tree | 116323417205a1d1c38ebed00f164899cdd84225 /src/Util.hs | |
parent | 4a737645b8e14b2857b11ee705438e30eef9e5bd (diff) |
Move test directory handling out of init/exit network helpers
Diffstat (limited to 'src/Util.hs')
-rw-r--r-- | src/Util.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Util.hs b/src/Util.hs index 4200e20..faf18af 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -9,3 +9,9 @@ uniqOn :: Eq b => (a -> b) -> [a] -> [a] uniqOn f (x:y:xs) | f x == f y = uniqOn f (x:xs) | otherwise = x : uniqOn f (y:xs) uniqOn _ xs = xs + +andM :: (Foldable t, Monad m) => t (m Bool) -> m Bool +andM = foldr (\a b -> a >>= \case True -> b; False -> return False) (return True) + +allM :: (Foldable t, Monad m) => (a -> m Bool) -> t a -> m Bool +allM f = foldr (\a b -> f a >>= \case True -> b; False -> return False) (return True) |