X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FMaskable.hs;h=cf1d2426b221039629f3dafe53b3d1b7c40a786c;hb=45ac9baca360d0f0dabe4576fb44c1634a50dbf7;hp=9e72b8e211d04690242b93cd794195459fd4d4ba;hpb=1e69264c4a60fef95d0ad013f95b082b3db106ab;p=hath.git diff --git a/src/Maskable.hs b/src/Maskable.hs index 9e72b8e..cf1d242 100644 --- a/src/Maskable.hs +++ b/src/Maskable.hs @@ -1,21 +1,24 @@ -module Maskable where +module Maskable ( + Maskable(..) ) +where -import Bit -import Maskbits +import Bit (Bit) +import Maskbits (Maskbits) --- Any string of bits should be maskable by some number of netmask --- bits. The convention of the Maskable typeclass follows CIDR --- notation, where the number of mask bits (the number after the --- slash) denotes how many bits are reserved for the network. +-- | Any string of bits should be maskable by some number of netmask +-- bits. The convention of the Maskable typeclass follows CIDR +-- notation, where the number of mask bits (the number after the +-- slash) denotes how many bits are reserved for the network. -- --- So, a mask of 32 applied to an address of 127.0.0.1 will again --- return 127.0.0.1. Likewise, 31 mask bits applied to 127.0.0.1 --- should return 127.0.0.0, since 127.0.0.1/31 matches both 127.0.0.0 --- and 127.0.0.1. In this case, the final '0' or '1' is the host --- part of the address. The '127.0.0' is thus the network part. +-- So, a mask of 32 applied to an address of 127.0.0.1 will again +-- return 127.0.0.1. Likewise, 31 mask bits applied to 127.0.0.1 +-- should return 127.0.0.0, since 127.0.0.1/31 matches both +-- 127.0.0.0 and 127.0.0.1. In this case, the final '0' or '1' is +-- the host part of the address. The '127.0.0' is thus the network +-- part. +-- +-- The Bit argument allows us to specify whether the host bits +-- should be replaced with either Zero or One. -- --- The Bit argument allows us to specify whether the host bits --- should be replaced with either Zero or One. class Maskable a where apply_mask :: a -> Maskbits -> Bit -> a -