Permalink
Browse files

removed support for too unstable features

- declare 'Put's as internal
- remove support for chunked encoding
- remove support for size-prefixing
- remove padded encodings
  • Loading branch information...
1 parent 44a0939 commit 943854c494ee14197dd76ce4bba8eb6f7c91f55c @meiersi committed Feb 17, 2012
@@ -1,6 +1,4 @@
{-# LANGUAGE ScopedTypeVariables, CPP, BangPatterns #-}
-{-# OPTIONS_HADDOCK hide #-}
-
-- |
-- Copyright : 2010-2012 Simon Meier, 2010 Jasper van der Jeugt
-- License : BSD3-style (see LICENSE)
@@ -115,23 +115,10 @@ The following encodings implement the combintion of ZigZag encoding
, int64ZigZagBase128LE
, intZigZagBase128LE
- -- * Prefixing Builders with their (chunk) size
- -- | (Almost) zero-copy algorithms for prefixing 'Builder's with their
- -- (chunk) sizes.
-
- , encodeSizePrefixed
- , encodeChunked
-
- , PaddedSizeEncoding
- , word64Base128LEPadded
- , word64HexPadded
- , word64DecPadded
-
) where
import Data.ByteString.Lazy.Builder.Internal
-import Data.ByteString.Lazy.Builder.Transformers
import qualified Data.ByteString.Lazy.Builder.BasicEncoding as E
import Foreign
@@ -1,5 +1,4 @@
{-# LANGUAGE ScopedTypeVariables, CPP, BangPatterns, Rank2Types #-}
-{-# OPTIONS_HADDOCK hide #-}
-- | Copyright : (c) 2010 - 2011 Simon Meier
-- License : BSD3-style (see LICENSE)
--
@@ -945,10 +944,10 @@ buildStepToCIOS
:: AllocationStrategy -- ^ Buffer allocation strategy to use
-> BuildStep a -- ^ 'BuildStep' to execute
-> IO (ChunkIOStream a)
-buildStepToCIOS !strategy@(AllocationStrategy nextBuffer bufSize trim) =
+buildStepToCIOS !(AllocationStrategy nextBuffer bufSize trim) =
\step -> nextBuffer Nothing >>= fill step
where
- fill !step !buf@(Buffer fpbuf br@(BufferRange op pe)) = do
+ fill !step !buf@(Buffer fpbuf br@(BufferRange _ pe)) = do
res <- fillWithBuildStep step doneH fullH insertChunkH br
touchForeignPtr fpbuf
return res
@@ -1,64 +0,0 @@
-{-# LANGUAGE BangPatterns #-}
------------------------------------------------------------------------------
--- | Copyright : (c) 2012 Simon Meier
--- License : BSD3-style (see LICENSE)
---
--- Maintainer : Simon Meier <iridcode@gmail.com>
--- Portability : GHC
---
--- The 'Put' monad generalizes 'Builder's to monadic actions that write a
--- stream of bytes as their side-effect.
------------------------------------------------------------------------------
-module Data.ByteString.Lazy.Builder.Put
- (
- Put
-
- -- * Execution
- , hPut
- , toLazyByteString
- , toLazyByteStringWith
-
- -- * Conversion to and from Builders
- , putBuilder
- , fromPut
-
- -- * Prefixing Puts with their (chunk) size
- , putSizePrefixed
- , putChunked
-
- ) where
-
-import qualified Data.ByteString.Lazy as L
-import Data.ByteString.Lazy.Builder.Internal
- hiding (toLazyByteStringWith)
-import Data.ByteString.Lazy.Builder.Transformers
- (putChunked, putSizePrefixed)
-
-#if MIN_VERSION_base(4,4,0)
-import System.IO.Unsafe (unsafePerformIO)
-#else
-import Foreign
-#endif
-
-{-# NOINLINE toLazyByteString #-}
-toLazyByteString :: Put a -- ^ 'Put' to execute
- -> (a, L.ByteString) -- ^ Result and lazy 'L.ByteString'
- -- written as its side-effect
-toLazyByteString = toLazyByteStringWith
- (safeStrategy smallChunkSize defaultChunkSize) (\x -> (x, L.empty))
-
-
-{-# INLINE toLazyByteStringWith #-}
-toLazyByteStringWith
- :: AllocationStrategy
- -- ^ Buffer allocation strategy to use
- -> (a -> (b, L.ByteString))
- -- ^ Continuation to use for generating the final result and the tail
- -- of its side-effect (the written bytes).
- -> Put a
- -- ^ 'Put' to execute
- -> (b, L.ByteString)
- -- ^ Resulting lazy 'L.ByteString'
-toLazyByteStringWith strategy k p =
- ciosToLazyByteString strategy k $ unsafePerformIO $
- buildStepToCIOS strategy (runPut p)
Oops, something went wrong.

0 comments on commit 943854c

Please sign in to comment.