packages feed

network-byte-order 0.1.6 → 0.1.7

raw patch · 3 files changed

+30/−51 lines, 3 filesdep −doctestdep ~base

Dependencies removed: doctest

Dependency ranges changed: base

Files

Network/ByteOrder.hs view
@@ -85,6 +85,7 @@ import System.IO.Unsafe (unsafeDupablePerformIO)  -- $setup+-- >>> :set -XOverloadedStrings -- >>> import Data.ByteString hiding (foldl') -- >>> import Data.Word -- >>> import Data.List@@ -426,7 +427,7 @@ -- | Write three bytes and ff one byte. --   If buffer overrun occurs, 'BufferOverrun' is thrown. ----- >>> withWriteBuffer 3 $ \wbuf -> write24 wbuf (65 * 256^2 + 66 * 256 + 67)+-- >>> withWriteBuffer 3 $ \wbuf -> write24 wbuf (65 * 256^(2 :: Int) + 66 * 256 + 67) -- "ABC" write24 :: WriteBuffer -> Word32 -> IO () write24 WriteBuffer{..} w = do@@ -440,7 +441,7 @@ -- | Write four bytes and ff one byte. --   If buffer overrun occurs, 'BufferOverrun' is thrown. ----- >>> withWriteBuffer 4 $ \wbuf -> write32 wbuf (65 * 256^3 + 66 * 256^2 + 67 * 256 + 68)+-- >>> withWriteBuffer 4 $ \wbuf -> write32 wbuf (65 * 256^(3 :: Int) + 66 * 256^(2 :: Int) + 67 * 256 + 68) -- "ABCD" write32 :: WriteBuffer -> Word32 -> IO () write32 WriteBuffer{..} w = do@@ -585,6 +586,7 @@     -- | Returning the length of the remaining     remainingSize :: a -> IO Int     -- | Executing an action on the current offset pointer.+    position :: a -> IO Int     withCurrentOffSet :: a -> (Buffer -> IO b) -> IO b     -- | Memorizing the current offset pointer.     save :: a -> IO ()@@ -624,6 +626,9 @@     remainingSize WriteBuffer{..} = do         ptr <- readIORef offset         return $ limit `minusPtr` ptr+    position WriteBuffer{..} = do+        ptr <- readIORef offset+        return $ ptr `minusPtr` start     {-# INLINE withCurrentOffSet #-}     withCurrentOffSet WriteBuffer{..} action = readIORef offset >>= action     {-# INLINE save #-}@@ -647,6 +652,8 @@     ff (ReadBuffer w) = ff w     {-# INLINE remainingSize #-}     remainingSize (ReadBuffer w) = remainingSize w+    {-# INLINE position #-}+    position (ReadBuffer w) = position w     {-# INLINE withCurrentOffSet #-}     withCurrentOffSet (ReadBuffer w) = withCurrentOffSet w     {-# INLINE save #-}
network-byte-order.cabal view
@@ -1,42 +1,24 @@--- Initial network-byte-order.cabal generated by cabal init.  For further--- documentation, see http://haskell.org/cabal/users-guide/+cabal-version: >=1.10+name:          network-byte-order+version:       0.1.7+license:       BSD3+license-file:  LICENSE+maintainer:    kazu@iij.ad.jp+author:        Kazu Yamamoto+synopsis:      Network byte order utilities+description:   Peek and poke functions for network byte order.+category:      Network+build-type:    Simple -name:                network-byte-order-version:             0.1.6-synopsis:            Network byte order utilities-description:         Peek and poke functions for network byte order.-license:             BSD3-license-file:        LICENSE-author:              Kazu Yamamoto-maintainer:          kazu@iij.ad.jp--- copyright:-category:            Network-build-type:          Simple--- extra-source-files:  ChangeLog.md-cabal-version:       >= 1.10+source-repository head+    type:     git+    location: git://github.com/kazu-yamamoto/network-byte-order.git  library-  ghc-options:         -Wall-  exposed-modules:     Network.ByteOrder-  -- other-modules:-  -- other-extensions:-  build-depends:       base >= 4.8 && < 5-                     , bytestring-  -- hs-source-dirs:-  default-language:    Haskell2010-  if impl(ghc >= 8)-      default-extensions:  Strict StrictData--test-suite doctest-  type:                 exitcode-stdio-1.0-  default-language:     Haskell2010-  hs-source-dirs:       test-  ghc-options:          -Wall-  main-is:              doctests.hs-  build-depends:        base-                      , bytestring-                      , doctest--source-repository head-  type:     git-  location: git://github.com/kazu-yamamoto/network-byte-order.git+    exposed-modules:    Network.ByteOrder+    default-language:   Haskell2010+    default-extensions: Strict StrictData+    ghc-options:        -Wall+    build-depends:+        base >=4.9 && <5,+        bytestring
− test/doctests.hs
@@ -1,10 +0,0 @@-module Main where--import Test.DocTest--main :: IO ()-main = doctest [-    "-XOverloadedStrings"-  , "-XCPP"-  , "Network/ByteOrder.hs"-  ]