@@ -37,7 +37,7 @@ module Data.Vector.Fusion.Stream.Monadic (
3737 zip , zip3 , zip4 , zip5 , zip6 ,
3838
3939 -- * Comparisons
40- eq , cmp ,
40+ eqBy , cmpBy ,
4141
4242 -- * Filtering
4343 filter , filterM , uniq , mapMaybe , takeWhile , takeWhileM , dropWhile , dropWhileM ,
@@ -625,9 +625,9 @@ zip6 = zipWith6 (,,,,,)
625625-- -----------
626626
627627-- | Check if two 'Stream's are equal
628- eq :: (Monad m , Eq a ) = > Stream m a -> Stream m a -> m Bool
629- {-# INLINE_FUSED eq #-}
630- eq (Stream step1 t1) (Stream step2 t2) = eq_loop0 SPEC t1 t2
628+ eqBy :: (Monad m ) => ( a -> b -> Bool ) - > Stream m a -> Stream m b -> m Bool
629+ {-# INLINE_FUSED eqBy #-}
630+ eqBy eq (Stream step1 t1) (Stream step2 t2) = eq_loop0 SPEC t1 t2
631631 where
632632 eq_loop0 ! _ s1 s2 = do
633633 r <- step1 s1
@@ -640,7 +640,7 @@ eq (Stream step1 t1) (Stream step2 t2) = eq_loop0 SPEC t1 t2
640640 r <- step2 s2
641641 case r of
642642 Yield y s2'
643- | x == y -> eq_loop0 SPEC s1 s2'
643+ | eq x y -> eq_loop0 SPEC s1 s2'
644644 | otherwise -> return False
645645 Skip s2' -> eq_loop1 SPEC x s1 s2'
646646 Done -> return False
@@ -653,9 +653,9 @@ eq (Stream step1 t1) (Stream step2 t2) = eq_loop0 SPEC t1 t2
653653 Done -> return True
654654
655655-- | Lexicographically compare two 'Stream's
656- cmp :: (Monad m , Ord a ) = > Stream m a -> Stream m a -> m Ordering
657- {-# INLINE_FUSED cmp #-}
658- cmp (Stream step1 t1) (Stream step2 t2) = cmp_loop0 SPEC t1 t2
656+ cmpBy :: (Monad m ) => ( a -> b -> Ordering ) - > Stream m a -> Stream m b -> m Ordering
657+ {-# INLINE_FUSED cmpBy #-}
658+ cmpBy cmp (Stream step1 t1) (Stream step2 t2) = cmp_loop0 SPEC t1 t2
659659 where
660660 cmp_loop0 ! _ s1 s2 = do
661661 r <- step1 s1
@@ -667,7 +667,7 @@ cmp (Stream step1 t1) (Stream step2 t2) = cmp_loop0 SPEC t1 t2
667667 cmp_loop1 ! _ x s1 s2 = do
668668 r <- step2 s2
669669 case r of
670- Yield y s2' -> case x `compare ` y of
670+ Yield y s2' -> case x `cmp ` y of
671671 EQ -> cmp_loop0 SPEC s1 s2'
672672 c -> return c
673673 Skip s2' -> cmp_loop1 SPEC x s1 s2'
0 commit comments