Similar to Data.Edison.Coll.EnumSet but it allows to choose the underlying type for bit storage. This is really a low-level module for type-safe foreign function interfaces.
The integer representation of the enumeration type is the bit position of the flag within the bitvector.
- newtype T word index = Cons {
- decons :: word
- fromEnum :: (Enum a, Bits w) => a -> T w a
- fromEnums :: (Enum a, Bits w) => [a] -> T w a
- toEnums :: (Enum a, Bits w) => T w a -> [a]
- intToEnums :: (Enum a, Integral w) => T w a -> [a]
- mostSignificantPosition :: (Bits w, Storable w) => T w a -> Int
- singletonByPosition :: Bits w => Int -> T w a
- null :: (Enum a, Bits w) => T w a -> Bool
- empty :: (Enum a, Bits w) => T w a
- singleton :: (Enum a, Bits w) => a -> T w a
- disjoint :: (Enum a, Bits w) => T w a -> T w a -> Bool
- subset :: (Enum a, Bits w) => T w a -> T w a -> Bool
- (.&.), xor, (.|.), (.-.) :: (Enum a, Bits w) => T w a -> T w a -> T w a
- unions :: (Enum a, Bits w) => [T w a] -> T w a
- get :: (Enum a, Bits w) => a -> T w a -> Bool
- put :: (Enum a, Bits w) => a -> Bool -> T w a -> T w a
- accessor :: (Enum a, Bits w) => a -> T (T w a) Bool
- set :: (Enum a, Bits w) => a -> T w a -> T w a
- clear :: (Enum a, Bits w) => a -> T w a -> T w a
- flip :: (Enum a, Bits w) => a -> T w a -> T w a
- fromBool :: (Enum a, Bits w) => a -> Bool -> T w a
Documentation
intToEnums :: (Enum a, Integral w) => T w a -> [a]Source
mostSignificantPosition :: (Bits w, Storable w) => T w a -> IntSource
floor of binary logarithm -
Intended for getting the position of a single set bit.
This in turn is intended for implementing an Enum
instance
if you only know masks but no bit positions.
singletonByPosition :: Bits w => Int -> T w aSource
set a bit -
Intended for implementing an Enum
instance
if you only know masks but no bit positions.