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

index 266b7c57f8a8e8318124a2518900de75a4d166ca..df35138aa8fca2d6f43c7a952f146f1fc8e4da87 100644 (file)
@@ -13,7 +13,12 @@ import Octet
 
 data Cidr = None | Cidr { ipv4address :: IPv4Address,
                           maskbits :: Maskbits }
-            deriving (Eq, Show)
+            deriving (Eq)
+
+
+instance Show Cidr where
+    show Cidr.None = "None"
+    show cidr = (show (ipv4address cidr)) ++ "/" ++ (show (maskbits cidr))
 
 
 -- Returns the mask portion of a CIDR address. That is, everything