Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4.4: Add reverse encoders for packed repeated fields. #108

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
1.4.4
- Support GHC 9.10
- Add encoders for packed repeated fields that reverse
the order of the elements and/or apply a function to each
element of a Foldable container to produce the desired value.
- Add bytesIfNonempty, unsafeFromByteString, unsafeFromShortByteString.

1.4.3
- Support GHC 9.8
Expand Down
9 changes: 4 additions & 5 deletions bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Proto3.Wire

import Control.Applicative (liftA2, liftA3)
import Control.Monad (forM)
import Data.Maybe
import Data.Word
import Data.IORef

Expand All @@ -39,7 +38,7 @@ instance Foldable Tree where
in a + a1 + a2

instance Foldable Rose where
foldMap f Bud = mempty
foldMap _ Bud = mempty
foldMap f (Rose x rs) = f x <> ((foldMap.foldMap) f rs)

intTreeParser :: De.Parser De.RawMessage (Tree Word64)
Expand Down Expand Up @@ -123,9 +122,9 @@ pullInt :: IORef [Word64] -> IO Word64
pullInt xs = do
xs' <- readIORef xs
case xs' of
[] -> pure (-1)
x : xs' -> do
writeIORef xs xs'
[] -> pure (negate 1)
x : xs'' -> do
writeIORef xs xs''
pure x

mkTree0 :: IO Word64 -> IO En.MessageBuilder
Expand Down
Loading
Loading