From a5c2a06421f9faf2c58831f1ac296bc6b8e7e040 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 6 May 2011 20:32:07 -0400 Subject: [PATCH] Have the show function display the grid size of a cube. --- src/Cube.hs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Cube.hs b/src/Cube.hs index 53bf105..78c5ec2 100644 --- a/src/Cube.hs +++ b/src/Cube.hs @@ -18,14 +18,19 @@ data Cube = Cube { h :: Double, instance Show Cube where show c = - "Cube_" ++ (show (i c)) ++ "," ++ (show (j c)) ++ "," ++ (show (k c)) ++ - " (Center: " ++ (show (center c)) ++ ")" ++ - " (xmin: " ++ (show (xmin c)) ++ ")" ++ - " (xmax: " ++ (show (xmax c)) ++ ")" ++ - " (ymin: " ++ (show (ymin c)) ++ ")" ++ - " (ymax: " ++ (show (ymax c)) ++ ")" ++ - " (zmin: " ++ (show (zmin c)) ++ ")" ++ - " (zmax: " ++ (show (zmax c)) ++ ")" + "Cube_" ++ subscript ++ "\n" ++ + " h: " ++ (show (h c)) ++ "\n" ++ + " Center: " ++ (show (center c)) ++ "\n" ++ + " xmin: " ++ (show (xmin c)) ++ "\n" ++ + " xmax: " ++ (show (xmax c)) ++ "\n" ++ + " ymin: " ++ (show (ymin c)) ++ "\n" ++ + " ymax: " ++ (show (ymax c)) ++ "\n" ++ + " zmin: " ++ (show (zmin c)) ++ "\n" ++ + " zmax: " ++ (show (zmax c)) ++ "\n" + where + subscript = + (show (i c)) ++ "," ++ (show (j c)) ++ "," ++ (show (k c)) + empty_cube :: Cube empty_cube = Cube 0 0 0 0 empty_values -- 2.43.2