@@ -504,17 +504,20 @@ wordBy =
504504-- Right _ -> False
505505-- Left _ -> True)
506506
507−-- deintercalate :: Property
508−-- deintercalate =
509−-- forAll (listOf (chooseInt (0, 1))) $ \ls ->
510−-- case S.parse (P.deintercalate concatFold prsr_1 concatFold prsr_2) (S.fromList ls) of
511−-- Right parsed_list_tuple -> parsed_list_tuple == (partition (== 0) ls)
512−-- Left _ -> False
507+deintercalate :: Property
508+deintercalate =
509+ forAll (listOf (chooseAny :: Gen Int)) $ \ls ->
510+ case S.parse p (S.fromList ls) of
511+ Right evenOdd -> evenOdd == List.partition even ls
512+ Left _ -> False
513513
514−-- where
515−-- prsr_1 = (P.takeWhile (== 0) FL.toList)
516−-- prsr_2 = (P.takeWhile (== 1) FL.toList)
517−-- concatFold = FL.Fold (\concatList curr_list -> return $ concatList ++ curr_list) (return []) return
514+ where
515+ p1 = P.takeWhile even FL.toList
516+ p2 = P.takeWhile odd FL.toList
517+ partition =
518+ FL.tee (fmap concat $ FL.lefts FL.toList)
519+ (fmap concat $ FL.rights FL.toList)
520+ p = P.deintercalate partition p1 p2
518521
519522-- shortestPass :: Property
520523-- shortestPass =
@@ -794,7 +797,7 @@ main =
794797 -- prop "" teeWithFailLeft
795798 -- prop "" teeWithFailRight
796799 -- prop "" teeWithFailBoth
797− -- prop "" deintercalate
800+ prop "deintercalate" deintercalate
798801 -- prop "" shortestPass
799802 -- prop "" shortestFailLeft
800803 -- prop "" shortestFailRight