-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Sets of enumeration values represented by machine words -- -- With this package you can create a type safe interface to flag sets. -- It is intended for interfacing to C libraries via FFI, where Word8, -- Word16, or Word32 types are commonly used to store bit vectors. E.g. -- the type EnumSet Word16 Ordering represents a flag set stored -- in a Word16 that supports the flags LT, EQ, -- GT. -- -- This package is similar to the bitset package the -- Data.Edison.Coll.EnumSet module in the edison package, -- however our implementation allows you to choose the embedding type and -- thus the maximum size of the set. @package enumset @version 0.0.1 -- | 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. module Data.EnumSet newtype T word enum Cons :: word -> T word enum decons :: T word enum -> 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] null :: (Enum a, Bits w) => T w a -> Bool empty :: (Enum a, Bits w) => T w a (.&.) :: (Enum a, Bits w) => T w a -> T w a -> T w a (.|.) :: (Enum a, Bits w) => T w a -> T w a -> T w a 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 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 instance Eq word => Eq (T word enum) instance (Storable word, Enum enum) => Storable (T word enum) -- | Extract and inject an Enum value into an EnumSet. module Data.EnumSet.PackedEnum -- | T w a b describes a contiguous set of bit indices into the -- word type w where the indices are of type a and the -- set of indices represent a value of type b. data T w a b Cons :: w -> Int -> T w a b -- | Extract an enumeration value from the specified index set. unpack :: (Integral w, Bits w, Enum a, Enum b) => T w a b -> T w a -> b -- | Create an enumeration set, where an value of type b is placed -- at the specified indices. pack :: (Bits w, Enum a, Enum b) => T w a b -> b -> T w a -- | Clear all bits at the specified indices. clear :: (Bits w, Enum a, Enum b) => T w a b -> T w a -> T w a -- | Overwrite an enumset at the specified indices with the value of type -- b. put :: (Bits w, Enum a, Enum b) => T w a b -> b -> T w a -> T w a