capnp 0.6.0.0 → 0.6.0.1
raw patch · 4 files changed
+35/−12 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- capnp.cabal +2/−2
- cmd/capnpc-haskell/Trans/PureToHaskell.hs +11/−5
- lib/Capnp/Message.hs +3/−3
- lib/Capnp/Tutorial.hs +19/−2
capnp.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: capnp-version: 0.6.0.0+version: 0.6.0.1 category: Data, Serialization, Network, Rpc copyright: 2016-2020 haskell-capnp contributors (see CONTRIBUTORS file). author: Ian Denhardt@@ -58,7 +58,7 @@ common shared-opts build-depends:- base >= 4.11 && < 4.14+ base >= 4.11 && < 5 , bytes >= 0.15.4 && <0.18 , bytestring ^>= 0.10 , containers >= 0.5.9 && <0.7
cmd/capnpc-haskell/Trans/PureToHaskell.hs view
@@ -714,11 +714,17 @@ TUnit typeToType _thisMod (C.WordType (C.PrimWord ty)) = TPrim ty-typeToType _thisMod (C.WordType (C.EnumType Name.CapnpQ{local, fileId})) =- -- Enums are just re-exported from the raw module, we should still- -- refer to them qualified even if they're in the file we're generated- -- from:- tgName (rawModule fileId) local+typeToType thisMod (C.WordType (C.EnumType Name.CapnpQ{local, fileId})) =+ -- Enums are just re-exported from the raw module, so we have a choice as to+ -- how to refer to them. Using their 'Pure' module makes sure we pull in any+ -- type class instances in those modules, but we have to make an exception+ -- if the enum is defined in the file we're generating code for, since otherwise+ -- we'd introduce a cyclic dependency. In that case we use the raw name; the+ -- instnaces are defined in this same module so we don't need to worry about those.+ if thisMod == fileId then+ tgName (rawModule fileId) local+ else+ tgName (pureModule fileId) local typeToType thisMod (C.CompositeType (C.StructType n)) = nameToType thisMod n typeToType thisMod (C.PtrType (C.PtrComposite (C.StructType n))) =
lib/Capnp/Message.hs view
@@ -312,7 +312,7 @@ let numSegs = numSegs' + 1 invoice (fromIntegral numSegs `div` 2) segSizes <- V.replicateM (fromIntegral numSegs) read32- when (numSegs `mod` 2 == 0) $ void read32+ when (even numSegs) $ void read32 V.mapM_ (invoice . fromIntegral) segSizes constSegs <- V.mapM (readSegment . fromIntegral) segSizes pure ConstMsg{constSegs, constCaps = V.empty}@@ -324,8 +324,8 @@ writeMessage ConstMsg{constSegs} write32 writeSegment = do let numSegs = V.length constSegs write32 (fromIntegral numSegs - 1)- V.forM_ constSegs $ \seg -> write32 =<< fromIntegral <$> numWords seg- when (numSegs `mod` 2 == 0) $ write32 0+ V.forM_ constSegs $ \seg -> write32 . fromIntegral =<< numWords seg+ when (even numSegs) $ write32 0 V.forM_ constSegs writeSegment
lib/Capnp/Tutorial.hs view
@@ -13,6 +13,9 @@ -- * Overview -- $overview + -- * Setup+ -- $setup+ -- * Serialization -- $serialization @@ -52,6 +55,19 @@ -- -- This module provides an overview of the capnp library. +-- $setup+--+-- In order to generate code from schema files, you will first need to make+-- sure the @capnp@ and @capnpc-haskell@ binaries are in your @$PATH@. The+-- former ships with the capnproto reference implementation; see+-- <https://capnproto.org/install.html>. The latter is included with this+-- library; to install it you can run the command:+--+-- > cabal v2-install capnp --installdir=$DIR+--+-- which will compile the package and create the @capnpc-haskell@ executable+-- at @$DIR/capnpc-haskell@.+ -- $serialization -- -- The serialization API is roughly divided into two parts: a low level API@@ -121,7 +137,8 @@ -- > } -- -- Once the @capnp@ and @capnpc-haskell@ executables are installed and in--- your @$PATH@, you can generate code for this schema by running:+-- your @$PATH@ (see the Setup section above), you can generate code for+-- this schema by running: -- -- > capnp compile -ohaskell addressbook.capnp --@@ -327,7 +344,7 @@ -- name is what the name of the struct type would be). -- * Fields of type `AnyPointer` map to the types defined in -- @Capnp.Untyped.Pure@.--- * Interfaces generated associated type classes and client types; see+-- * Interfaces generate associated type classes and client types; see -- the section on RPC. -- $lowlevel