bitfield 0.0.0.0 → 0.0.0.1
raw patch · 3 files changed
+9/−5 lines, 3 filesdep ~sydtestPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: sydtest
API changes (from Hackage documentation)
+ Data.Bitfield.Internal: instance GHC.Classes.Ord rep => GHC.Classes.Ord (Data.Bitfield.Internal.Bitfield rep a)
Files
- CHANGELOG.md +5/−1
- bitfield.cabal +2/−2
- src/Data/Bitfield/Internal.hs +2/−2
CHANGELOG.md view
@@ -2,7 +2,11 @@ `bitfield` uses [PVP Versioning][1]. -## 0.1.0.0+## 0.0.0.1++* Added Ord instance to Bitfield++## 0.0.0.0 * Initially created.
bitfield.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: bitfield-version: 0.0.0.0+version: 0.0.0.1 synopsis: Generic and easy to use haskell bitfields description: Generic and easy to use haskell bitfields. Allows packing and modifying datatypes in a compact representation. See `README.md` or 'Data.Bitfield' for documentation. license: MIT@@ -46,7 +46,7 @@ main-is: Spec.hs build-tool-depends: sydtest-discover:sydtest-discover build-depends: bitfield- , sydtest >= 0.12 && < 0.14+ , sydtest >= 0.12 && < 0.16 , validity >= 0.12 && < 0.13 , genvalidity >= 1.0 && < 1.2 , genvalidity-sydtest >= 1.0 && < 1.1
src/Data/Bitfield/Internal.hs view
@@ -66,7 +66,7 @@ -- @a@'s fields are also required to have an instance of 'AsRep' and 'FiniteBits'. This is provided for the most common -- types ('Int'/'Word' (and variants) and 'Bool'). newtype Bitfield (rep :: Type) (a :: Type) = Bitfield rep- deriving newtype (Eq, Storable)+ deriving newtype (Eq, Ord, Storable) -- | Access the underlying representation of the 'Bitfield' unwrap :: Bitfield rep a -> rep@@ -97,7 +97,7 @@ -- Beware that updates should be done with 'set', as 'pack' will recreate the entire 'Bitfield' -- from scratch. The following will most likely *not* be optimised: @pack $ (unpack bitfield) { example = True }@ pack :: forall rep a . (Fits rep a, Generic a, Bits rep, GPackBitfield rep (Rep a)) => a -> Bitfield rep a-pack a = case packI (Proxy @(Rep a)) 0 zeroBits (from a) of (_, b) -> Bitfield b+pack a = case packI (Proxy @(Rep a)) 0 (zeroBits :: rep) (from a) of (_, b) -> Bitfield b {-# INLINE pack #-} instance (Fits rep a, Generic a, GPackBitfield rep (Rep a), Show a) => Show (Bitfield rep a) where