Fix instances of 'PyValue'
authorJose A. Lopes <jabolopes@google.com>
Wed, 11 Sep 2013 08:19:51 +0000 (10:19 +0200)
committerJose A. Lopes <jabolopes@google.com>
Thu, 12 Sep 2013 11:01:44 +0000 (13:01 +0200)
Fix instances of 'PyValue', namely, for tuples and maps.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

src/Ganeti/PyValueInstances.hs

index 3c977b5..c84a3e2 100644 (file)
@@ -46,7 +46,7 @@ instance PyValue Double
 instance PyValue Char
 
 instance (PyValue a, PyValue b) => PyValue (a, b) where
-  showValue (x, y) = show (showValue x, showValue y)
+  showValue (x, y) = "(" ++ showValue x ++ "," ++ showValue y ++ ")"
 
 instance PyValue String where
   showValue = show
@@ -57,7 +57,7 @@ instance PyValue a => PyValue [a] where
 instance (PyValue k, PyValue a) => PyValue (Map k a) where
   showValue mp =
     "{" ++ intercalate ", " (map showPair (Map.assocs mp)) ++ "}"
-    where showPair (k, x) = show k ++ ":" ++ show x
+    where showPair (k, x) = showValue k ++ ":" ++ showValue x
 
 instance PyValue a => PyValue (ListSet a) where
   showValue = showValue . Set.toList . unListSet