Proposal [Trac #1212]: add IPv6 support to network library
Bryan O'Sullivan
bos at serpentine.com
Mon Apr 2 13:20:56 EDT 2007
Bryan O'Sullivan wrote:
> unpackBits :: Bits b => [(a, b)] -> b -> [a]
>
> unpackBits mapping bits = foldl' unpack [] mapping
> where unpack acc (k, v) | bits .&. v == 0 = acc
> | otherwise = k:acc
Of course, this is stricter than it needs to be, and should use foldr
instead of foldl'. But I hope that the idea is useful nevertheless :-)
<b
More information about the Libraries
mailing list