X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=blobdiff_plain;f=src%2FMaskbits.hs;h=ac46ccf96a316a3233e961d9e00d637c95c3d11b;hp=d7064d89ad81ee615fa9c0c470636b423db2687e;hb=e1d16438b44ecd962565756a828c9ed8014cf894;hpb=909e781852e3566fcaa16e156437ebe5bfc89e02 diff --git a/src/Maskbits.hs b/src/Maskbits.hs index d7064d8..ac46ccf 100644 --- a/src/Maskbits.hs +++ b/src/Maskbits.hs @@ -6,7 +6,7 @@ module Maskbits import Test.QuickCheck --- A type representing the number of bits in a CIDR netmask. +-- | A type representing the number of bits in a CIDR netmask. data Maskbits = Zero | One @@ -156,6 +156,8 @@ maskbits_from_int 31 = Just ThirtyOne maskbits_from_int 32 = Just ThirtyTwo maskbits_from_int _ = Nothing + +-- | Convert a String to Maskbits, if possible. maskbits_from_string :: String -> Maybe Maskbits maskbits_from_string s = case (reads s :: [(Int, String)]) of @@ -164,6 +166,7 @@ maskbits_from_string s = +-- | Maskbits are just natural numbers, this returns the previous one. decrement :: Maskbits -> Maskbits decrement Zero = Zero decrement One = Zero