diff --git a/common/Utils.hs b/common/Utils.hs index d6ba900..6f9f32f 100644 --- a/common/Utils.hs +++ b/common/Utils.hs @@ -265,3 +265,10 @@ zipMap f xs ys = Map.fromList $ mapMaybe f' (Set.elems allKeys) allKeys = Map.keysSet xs `Set.union` Map.keysSet ys f' k = transformMaybe ((,) k) $ f (Map.lookup k xs) (Map.lookup k ys) + +showMaybe :: (a -> String) -> Maybe a -> String +showMaybe showFunc (Just x) = "Just " ++ showFunc x +showMaybe _ Nothing = "Nothing" + +showListCustom :: (a -> String) -> [a] -> String +showListCustom showFunc list = "[" ++ concat (intersperse "," (map showFunc list)) ++ "]" diff --git a/transformations/ArrayUsageCheckTest.hs b/transformations/ArrayUsageCheckTest.hs index c4ee671..7dbe5a2 100644 --- a/transformations/ArrayUsageCheckTest.hs +++ b/transformations/ArrayUsageCheckTest.hs @@ -226,10 +226,6 @@ check s (ind, eq, ineq) = ++ "(VM after pruning was: " ++ showMaybe showTestAnswers (transformMaybe fst sapped) ++ ", ineqs: " ++ showMaybe showInequalities (transformMaybe snd sapped) ++ ")" -showMaybe :: (a -> String) -> Maybe a -> String -showMaybe f (Just x) = f x -showMaybe _ Nothing = "Nothing" - testMakeEquations :: Test testMakeEquations = TestList [