+ show oct = show (octet_to_int oct)
+
+
+instance Arbitrary Octet where
+ arbitrary = do
+ a1 <- arbitrary :: Gen Bit
+ a2 <- arbitrary :: Gen Bit
+ a3 <- arbitrary :: Gen Bit
+ a4 <- arbitrary :: Gen Bit
+ a5 <- arbitrary :: Gen Bit
+ a6 <- arbitrary :: Gen Bit
+ a7 <- arbitrary :: Gen Bit
+ a8 <- arbitrary :: Gen Bit
+ return (Octet a1 a2 a3 a4 a5 a6 a7 a8)
+
+
+instance Maskable Octet where
+ apply_mask oct Eight _ = oct
+
+ apply_mask oct Seven bit =
+ oct { b8 = bit }
+
+ apply_mask oct Six bit =
+ oct { b8 = bit, b7 = bit }
+
+ apply_mask oct Five bit =
+ oct { b8 = bit, b7 = bit, b6 = bit }
+
+ apply_mask oct Four bit =
+ oct { b8 = bit, b7 = bit, b6 = bit, b5 = bit }
+
+ apply_mask oct Three bit =
+ oct { b8 = bit, b7 = bit, b6 = bit, b5 = bit, b4 = bit }
+
+ apply_mask oct Two bit =
+ oct { b8 = bit, b7 = bit, b6 = bit, b5 = bit, b4 = bit, b3 = bit }
+
+ apply_mask oct Maskbits.One bit =
+ oct { b8 = bit, b7 = bit, b6 = bit, b5 = bit,
+ b4 = bit, b3 = bit, b2 = bit }