Blaze.ByteString.Builder.Internal.Types

blaze-builder-0.3.3.4: Efficient buffered output.

Copyright | (c) 2010 Simon Meier
License | BSD3-style (see LICENSE)
Maintainer | Simon Meier <iridcode@gmail.com>
Stability | experimental
Portability | tested on GHC only
Safe Haskell | Safe
Language | Haskell98

Blaze.ByteString.Builder.Internal.Types

Description

Core types and functions for the `Builder` monoid and the `Put` monad based based on the 'blaze-builder' library by Jasper van der Jeugt and Simon Meier.

Synopsis

- data BufRange = BufRange !(Ptr Word8) !(Ptr Word8)
- data BuildSignal a
  - = Done !(Ptr Word8) a
  - | BufferFull !Int !(Ptr Word8) !(BuildStep a)
  - | InsertByteString !(Ptr Word8) !ByteString !(BuildStep a)
- newtype BuildStep a = BuildStep {
  - runBuildStep :: BufRange -> IO (BuildSignal a)
  }
- done :: Ptr Word8 -> a -> BuildSignal a
- bufferFull :: Int -> Ptr Word8 -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a
- insertByteString :: Ptr Word8 -> ByteString -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a
- buildStep :: (BufRange -> IO (BuildSignal a)) -> BuildStep a
- newtype Builder = Builder {
  - unBuilder :: forall r. BuildStep r -> BuildStep r
  }
- newtype Put a = Put {
  - unPut :: forall r. (a -> BuildStep r) -> BuildStep r
  }
- putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Put a
- fromBuildStepCont :: (forall r. (BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Builder
- putBuilder :: Builder -> Put ()
- fromPut :: Put a -> Builder
- putLiftIO :: IO a -> Put a

# Documentation

data BufRange

Constructors

BufRange !(Ptr Word8) !(Ptr Word8) |

data BuildSignal a

Constructors

Done !(Ptr Word8) a |
BufferFull !Int !(Ptr Word8) !(BuildStep a) |
InsertByteString !(Ptr Word8) !ByteString !(BuildStep a) |

newtype BuildStep a

Constructors

BuildStep |
Fields runBuildStep :: BufRange -> IO (BuildSignal a)

done :: Ptr Word8 -> a -> BuildSignal a

bufferFull :: Int -> Ptr Word8 -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a

insertByteString :: Ptr Word8 -> ByteString -> (BufRange -> IO (BuildSignal a)) -> BuildSignal a

buildStep :: (BufRange -> IO (BuildSignal a)) -> BuildStep a

newtype Builder

Constructors

Builder |
Fields unBuilder :: forall r. BuildStep r -> BuildStep r

Instances

Monoid Builder |

newtype Put a

Constructors

Put |
Fields unPut :: forall r. (a -> BuildStep r) -> BuildStep r

Instances

Monad Put |
Functor Put |
Applicative Put |

putBuildStepCont :: (forall r. (a -> BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Put a

fromBuildStepCont :: (forall r. (BufRange -> IO (BuildSignal r)) -> BufRange -> IO (BuildSignal r)) -> Builder

putBuilder :: Builder -> Put ()

Put the given builder.

fromPut :: Put a -> Builder

Ignore the value of a put and only exploit its output side effect.

putLiftIO :: IO a -> Put a

Lift the given IO action.