File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ module Data.Vector.Generic (
158
158
159
159
-- ** Comparisons
160
160
eq , cmp ,
161
+ eqBy , cmpBy ,
161
162
162
163
-- ** Show and Read
163
164
showsPrec , readPrec ,
@@ -2131,6 +2132,11 @@ eq :: (Vector v a, Eq a) => v a -> v a -> Bool
2131
2132
{-# INLINE eq #-}
2132
2133
xs `eq` ys = stream xs == stream ys
2133
2134
2135
+ -- | /O(n)/
2136
+ eqBy :: (Vector v a , Vector v b ) => (a -> b -> Bool ) -> v a -> v b -> Bool
2137
+ {-# INLINE eqBy #-}
2138
+ eqBy e xs ys = Bundle. eqBy e (stream xs) (stream ys)
2139
+
2134
2140
-- | /O(n)/ Compare two vectors lexicographically. All 'Vector' instances are
2135
2141
-- also instances of 'Ord' and it is usually more appropriate to use those. This
2136
2142
-- function is primarily intended for implementing 'Ord' instances for new
@@ -2139,6 +2145,10 @@ cmp :: (Vector v a, Ord a) => v a -> v a -> Ordering
2139
2145
{-# INLINE cmp #-}
2140
2146
cmp xs ys = compare (stream xs) (stream ys)
2141
2147
2148
+ -- | /O(n)/
2149
+ cmpBy :: (Vector v a , Vector v b ) => (a -> b -> Ordering ) -> v a -> v b -> Ordering
2150
+ cmpBy c xs ys = Bundle. cmpBy c (stream xs) (stream ys)
2151
+
2142
2152
-- Show
2143
2153
-- ----
2144
2154
You can’t perform that action at this time.
0 commit comments