@@ -99,6 +99,8 @@ module Streamly.Prelude
9999 , length
100100 , all
101101 , any
102+ , and
103+ , or
102104 , maximum
103105 , minimum
104106 , sum
@@ -168,7 +170,7 @@ import Prelude
168170 hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
169171 foldl, map, mapM, mapM_, sequence, all, any, sum, product, elem,
170172 notElem, maximum, minimum, head, last, tail, length, null,
171− reverse, iterate, init)
173+ reverse, iterate, init, and, or)
172174import qualified Prelude
173175import qualified System.IO as IO
174176
@@ -572,6 +574,16 @@ all p m = S.all p (toStreamS m)
572574any :: Monad m => (a -> Bool) -> SerialT m a -> m Bool
573575any p m = S.any p (toStreamS m)
574576
577+-- | Determines if all elements of a boolean stream are True.
578+{-# INLINE and #-}
579+and :: Monad m => SerialT m Bool -> m Bool
580+and = all (==True)
581+
582+-- | Determines wheter at least one element of a boolean stream is True.
583+{-# INLINE or #-}
584+or :: Monad m => SerialT m Bool -> m Bool
585+or = any (==True)
586+
575587-- | Determine the sum of all elements of a stream of numbers
576588--
577589-- @since 0.1.0