From f445c30c4a089e8898fd1438747b3c7e33547890 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 19 Feb 2009 13:11:24 +0100 Subject: [PATCH] Let zipValueMapsWith show the trees in the error. --- HsValueMap.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/HsValueMap.hs b/HsValueMap.hs index 97e4cdb..f4498f2 100644 --- a/HsValueMap.hs +++ b/HsValueMap.hs @@ -57,15 +57,16 @@ mkHsValueMap ty = -- | Creates a map of pairs from two maps. The maps must have the same -- structure. -zipValueMaps :: HsValueMap a -> HsValueMap b -> HsValueMap (a, b) +zipValueMaps :: (Show a, Show b) => HsValueMap a -> HsValueMap b -> HsValueMap (a, b) zipValueMaps = zipValueMapsWith (\a b -> (a, b)) -- | Creates a map of two maps using the given combination function. -zipValueMapsWith :: (a -> b -> c) -> HsValueMap a -> HsValueMap b -> HsValueMap c +zipValueMapsWith :: (Show a, Show b) => (a -> b -> c) -> HsValueMap a -> HsValueMap b -> HsValueMap c zipValueMapsWith f (Tuple as) (Tuple bs) = Tuple $ zipWith (zipValueMapsWith f) as bs zipValueMapsWith f (Single a) (Single b) = Single $ f a b -zipValueMapWith _ _ _ = - error $ "Trying to zip unsimilarly formed trees!" +zipValueMapsWith _ a b = + --Tuple [] + error $ "Trying to zip unsimilarly formed trees!\n" ++ (show a) ++ "\nand\n" ++ (show b) -- 2.30.2