]> gitweb.michael.orlitzky.com - hath.git/commitdiff
Define a show instance for Maskbits.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 8 May 2010 17:04:06 +0000 (13:04 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 8 May 2010 17:04:06 +0000 (13:04 -0400)
src/Maskbits.hs

index cbd4dbe86fd0d76efa15ea349dfd353d06e62985..fcf57bdb379760ba2349bf2815e13aa62425085b 100644 (file)
@@ -38,7 +38,45 @@ data Maskbits = None
               | Thirty
               | ThirtyOne
               | ThirtyTwo
-              deriving (Eq, Ord, Show)
+              deriving (Eq, Ord)
+
+
+instance Show Maskbits where
+    show None        = "None"
+    show Zero        = "0"
+    show One         = "1"
+    show Two         = "2"
+    show Three       = "3"
+    show Four        = "4"
+    show Five        = "5"
+    show Six         = "6"
+    show Seven       = "7"
+    show Eight       = "8"
+    show Nine        = "9"
+    show Ten         = "10"
+    show Eleven      = "11"
+    show Twelve      = "12"
+    show Thirteen    = "13"
+    show Fourteen    = "14"
+    show Fifteen     = "15"
+    show Sixteen     = "16"
+    show Seventeen   = "17"
+    show Eighteen    = "18"
+    show Nineteen    = "19"
+    show Twenty      = "20"
+    show TwentyOne   = "21"
+    show TwentyTwo   = "22"
+    show TwentyThree = "23"
+    show TwentyFour  = "24"
+    show TwentyFive  = "25"
+    show TwentySix   = "26"
+    show TwentySeven = "27"
+    show TwentyEight = "28"
+    show TwentyNine  = "29"
+    show Thirty      = "30"
+    show ThirtyOne   = "31"
+    show ThirtyTwo   = "32"
+
 
 
 -- There are only 32 bits in an IPv4 address, so there