describe 0.4.0.1 → 0.4.0.2
raw patch · 6 files changed
+20/−7 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- describe.cabal +2/−1
- src/Data/Serialize/Describe/Combinators/BE.hs +3/−1
- src/Data/Serialize/Describe/Combinators/ByteEnum.hs +8/−4
- src/Data/Serialize/Describe/Combinators/LE.hs +2/−0
- src/Data/Serialize/Describe/Internal/Descriptor.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for describe +##0.4.0.2 -- 2020-02-07++* Added representational type roles for BE and LE+ ##0.4.0.1 -- 2020-01-19 * Fixed module exports
describe.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: describe-version: 0.4.0.1+version: 0.4.0.2 synopsis: Combinators for describing binary data structures description: Combinators for describing binary data structures, which eliminate the boilerplate of having to write isomorphic Get and Put instances. Please see the Github page for examples. homepage: https://github.com/riugabachi/describe@@ -24,6 +24,7 @@ RankNTypes, FunctionalDependencies, DeriveAnyClass,+ RoleAnnotations, DeriveGeneric, DerivingVia, OverloadedStrings,
src/Data/Serialize/Describe/Combinators/BE.hs view
@@ -43,9 +43,11 @@ f64 :: (Real f, Fractional f) => (s -> f) -> Descriptor s f f64 = isoField @(BE Double) rtf -newtype BE a +newtype BE a = BE { unwrapBE :: a } deriving newtype (Show, Read, Num, Eq, Ord, Enum, Integral, Real, Fractional)++type role BE representational instance Describe (BE Word16) where describe = mkDescriptor fi (const 2) getWord16be putWord16be
src/Data/Serialize/Describe/Combinators/ByteEnum.hs view
@@ -1,3 +1,11 @@+-- | @ByteEnum@ wraps an @Enum@ to be described as a Word8. Intended to be used with DerivingVia so as to not introduce unnecessary newtype wrappers:+--+-- >+-- > data MyEnum = A | B | C +-- > deriving Enum+-- > deriving Describe via ByteEnum MyEnum+-- >+-- module Data.Serialize.Describe.Combinators.ByteEnum where import GHC.Generics hiding (from)@@ -7,10 +15,6 @@ import Data.Serialize.Describe.Class import Data.Serialize.Describe.Isomorphisms --- | Wraps an @Enum@ to be described as a Word8. Intended to be used with DerivingVia so as to not introduce unnecessary newtype wrappers:--- > data MyEnum = A | B | C --- > deriving Enum--- > deriving Describe via ByteEnum MyEnum newtype ByteEnum e = ByteEnum { unwrapByteEnum :: e } deriving (Generic)
src/Data/Serialize/Describe/Combinators/LE.hs view
@@ -46,6 +46,8 @@ = LE { unwrapLE :: a } deriving newtype (Show, Read, Num, Eq, Ord, Enum, Integral, Real, Fractional) +type role LE representational+ instance Describe (LE Word16) where describe = mkDescriptor fi (const 2) getWord16le putWord16le
src/Data/Serialize/Describe/Internal/Descriptor.hs view
@@ -11,7 +11,7 @@ import Control.Monad.Trans.Control import Control.Monad.Morph --- | @Descriptor s a@ is an applicative functor that describes the binary structure for a structure 's' while deserializing value 'a'.+-- | @Descriptor s a@ is a monad that describes the binary structure for a structure 's' while deserializing value 'a'. newtype DescriptorM m s a = Descriptor { unwrapDescriptor :: (StateT Int (m Get) a, s -> StateT Int (m PutM) a) }