dahdit 0.1.1 → 0.1.2
raw patch · 3 files changed
+4/−4 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Dahdit.BinaryRep: instance (Dahdit.BinaryRep.BinaryRep x a, Dahdit.Binary.Binary x) => Dahdit.Binary.Binary (Dahdit.BinaryRep.ViaBinaryRep a)
- Dahdit.BinaryRep: instance (Dahdit.Sizes.ByteSized x, Dahdit.BinaryRep.BinaryRep x a) => Dahdit.Sizes.ByteSized (Dahdit.BinaryRep.ViaBinaryRep a)
- Dahdit.LiftedPrim: instance (GHC.Num.Num x, GHC.Real.Integral x, Dahdit.LiftedPrim.LiftedPrim x, GHC.Num.Num y, GHC.Real.Integral y) => Dahdit.LiftedPrim.LiftedPrim (Dahdit.Internal.ViaFromIntegral x y)
+ Dahdit.BinaryRep: instance Dahdit.BinaryRep.BinaryRep x a => Dahdit.Binary.Binary (Dahdit.BinaryRep.ViaBinaryRep a)
+ Dahdit.BinaryRep: instance Dahdit.BinaryRep.BinaryRep x a => Dahdit.Sizes.ByteSized (Dahdit.BinaryRep.ViaBinaryRep a)
+ Dahdit.LiftedPrim: instance (GHC.Real.Integral x, Dahdit.LiftedPrim.LiftedPrim x, GHC.Real.Integral y) => Dahdit.LiftedPrim.LiftedPrim (Dahdit.Internal.ViaFromIntegral x y)
Files
- dahdit.cabal +1/−1
- src/Dahdit/BinaryRep.hs +2/−2
- src/Dahdit/LiftedPrim.hs +1/−1
dahdit.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: dahdit-version: 0.1.1+version: 0.1.2 synopsis: Binary parsing and serialization with integrated size description: Please see the README on GitHub at <https://github.com/ejconlon/dahdit#readme> category: Data
src/Dahdit/BinaryRep.hs view
@@ -26,12 +26,12 @@ newtype ViaBinaryRep a = ViaBinaryRep { unViaBinaryRep :: a } -instance (ByteSized x, BinaryRep x a) => ByteSized (ViaBinaryRep a) where+instance BinaryRep x a => ByteSized (ViaBinaryRep a) where byteSize = byteSize . toBinaryRep . unViaBinaryRep instance (StaticByteSized x, BinaryRep x a) => StaticByteSized (ViaBinaryRep a) where staticByteSize _ = staticByteSize (Proxy :: Proxy x) -instance (BinaryRep x a, Binary x) => Binary (ViaBinaryRep a) where+instance BinaryRep x a => Binary (ViaBinaryRep a) where get = get >>= either fail (pure . ViaBinaryRep) . fromBinaryRep put = put . toBinaryRep . unViaBinaryRep
src/Dahdit/LiftedPrim.hs view
@@ -57,7 +57,7 @@ writeByteArrayLiftedInElems val arr pos = writeByteArray arr pos val -- | NOTE: Relies on same byte width of both types!-instance (Num x, Integral x, LiftedPrim x, Num y, Integral y) => LiftedPrim (ViaFromIntegral x y) where+instance (Integral x, LiftedPrim x, Integral y) => LiftedPrim (ViaFromIntegral x y) where elemSizeLifted _ = elemSizeLifted (Proxy :: Proxy x) indexByteArrayLiftedInBytes arr pos = ViaFromIntegral (fromIntegral (indexByteArrayLiftedInBytes arr pos :: x)) writeByteArrayLiftedInBytes val arr pos = let !x = fromIntegral (unViaFromIntegral val) :: x in writeByteArrayLiftedInBytes x arr pos