]> gitweb.michael.orlitzky.com - hath.git/commitdiff
Defined a show instance for IPv4Address.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 8 May 2010 16:57:14 +0000 (12:57 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 8 May 2010 16:57:14 +0000 (12:57 -0400)
src/IPv4Address.hs

index 8c5d4837853cb3511f59c38049d98d29e5d144fb..5296b24716de40985259ba253ced4bf769097d98 100644 (file)
@@ -24,7 +24,20 @@ data IPv4Address = None | IPv4Address { octet1 :: Octet,
                                         octet2 :: Octet,
                                         octet3 :: Octet,
                                         octet4 :: Octet }
-                 deriving (Eq, Show)
+                 deriving (Eq)
+
+
+instance Show IPv4Address where
+    show IPv4Address.None = "None"
+    show addr = concat [(show oct1) ++ ".",
+                        (show oct2) ++ ".",
+                        (show oct3) ++ ".",
+                        (show oct4)]
+        where
+          oct1 = (octet1 addr)
+          oct2 = (octet2 addr)
+          oct3 = (octet3 addr)
+          oct4 = (octet4 addr)
 
 
 -- We don't export our constructor so this function is the only