Moved showMaybe to the Utils module and added a similar showListCustom function

This commit is contained in:
Neil Brown 2008-01-15 18:08:56 +00:00
parent 05e2678cf6
commit d3fca1d610
2 changed files with 7 additions and 4 deletions

View File

@ -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)) ++ "]"

View File

@ -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
[