From: Michael Orlitzky Date: Sat, 7 May 2011 00:32:07 +0000 (-0400) Subject: Have the show function display the grid size of a cube. X-Git-Tag: 0.0.1~329 X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;ds=inline;h=a5c2a06421f9faf2c58831f1ac296bc6b8e7e040;p=spline3.git Have the show function display the grid size of a cube. --- 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