@@ -578,7 +578,8 @@ transformCombineOpsOrdered constr desc eq t = do
578578 transform (dropWhile (> 0)) t (S.dropWhile (> 0))
579579 prop (desc <> " scan") $ transform (scanl' (+) 0) t (S.scanl' (+) 0)
580580
581− -- XXX add uniq
581+ prop (desc <> " uniq") $ transform referenceUniq t S.uniq
582+
582583 prop (desc <> " deleteBy (<=) 0") $
583584 transform (deleteBy (<=) 0) t (S.deleteBy (<=) 0)
584585
@@ -617,10 +618,23 @@ wrapOutOfBounds f i x | null x = Nothing
617618 | otherwise = Just (f x i)
618619
619620wrapThe :: Eq a => [a] -> Maybe a
620−wrapThe (x:xs) | all (x ==) xs = Just x
621− | otherwise = Nothing
621+wrapThe (x:xs)
622+ | all (x ==) xs = Just x
623+ | otherwise = Nothing
622624wrapThe [] = Nothing
623625
626+-- This is the reference uniq implementation to compare uniq against,
627+-- we can use uniq from vector package, but for now this should
628+-- suffice.
629+referenceUniq :: Eq a => [a] -> [a]
630+referenceUniq = go
631+ where
632+ go [] = []
633+ go (x:[]) = [x]
634+ go (x:y:xs)
635+ | x == y = go (x : xs)
636+ | otherwise = x : go (y : xs)
637+
624638eliminationOps
625639 :: ([Int] -> t IO Int)
626640 -> String