packages feed

binrep 0.3.0 → 0.3.1

raw patch · 3 files changed

+13/−7 lines, 3 filesdep ~refineddep ~text-icuPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: refined, text-icu

API changes (from Hackage documentation)

- Binrep.Get: EEof :: EBase

Files

CHANGELOG.md view
@@ -1,3 +1,6 @@+## 0.3.1 (2022-08-28)+  * fix `Get [a]` instance+ ## 0.3.0 (2022-08-27)   * useful parsing errors in `Get`     * e.g. if parsing fails at "any Word64", emits "ran out, needed 8 bytes"
binrep.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           binrep-version:        0.3.0+version:        0.3.1 synopsis:       Encode precise binary representations directly in types description:    Please see README.md. category:       Data, Serialization@@ -122,7 +122,7 @@   if flag(icu)     cpp-options: -DHAVE_ICU     build-depends:-        text-icu >=0.8.0.1 && <0.9+        text-icu >=0.7.0.0 && <0.9   default-language: Haskell2010  test-suite spec@@ -192,5 +192,5 @@   if flag(icu)     cpp-options: -DHAVE_ICU     build-depends:-        text-icu >=0.8.0.1 && <0.9+        text-icu >=0.7.0.0 && <0.9   default-language: Haskell2010
src/Binrep/Get.hs view
@@ -52,7 +52,6 @@ data EBase   = ENoVoid   | EFail-  | EEof    | EExpectedByte Word8 Word8   -- ^ expected first, got second@@ -105,9 +104,13 @@ --   succeeds by reaching EOF. Probably not what you usually want, but sometimes --   used at the "top" of binary formats. instance Get a => Get [a] where-    get = do as <- FP.many get-             cutEBase FP.eof EEof-             return as+    get = go+      where+        go = do+            FP.withOption FP.eof (\() -> pure []) $ do+                a <- get+                as <- go+                pure $ a : as  instance (Get a, Get b) => Get (a, b) where     get = do