blaze-builder-enumerator (empty) → 0.1
raw patch · 4 files changed
+89/−0 lines, 4 filesdep +basedep +blaze-builderdep +bytestringsetup-changed
Dependencies added: base, blaze-builder, bytestring, enumerator
Files
- Blaze/ByteString/Builder/Enumerator.hs +28/−0
- LICENSE +25/−0
- Setup.hs +2/−0
- blaze-builder-enumerator.cabal +34/−0
+ Blaze/ByteString/Builder/Enumerator.hs view
@@ -0,0 +1,28 @@+------------------------------------------------------------------------------+-- | +-- Module : Blaze.ByteString.Builder.Enumerator+-- License : BSD3+-- Maintainer : Thomas Sutton <me@thomas-sutton.id.au>+-- Stability : Experimental+-- Portability : Unknown+--+-- Simplify the process of using @blaze-builder@ with @enumerator@ by +-- converting functions that construct 'Builder's into 'Iteratee's.+------------------------------------------------------------------------------++module Blaze.ByteString.Builder.Enumerator where++import Blaze.ByteString.Builder+import qualified Data.ByteString as B+import Data.Enumerator++-- | Convert a function that returns a @blaze-builder@ 'Builder' into an +-- 'Iteratee'. Each incoming value will be converted into a 'ByteString'.+iterBuilder :: Monad m => (a -> Builder) -> Iteratee a m B.ByteString+iterBuilder builder = continue (step builder)+ where+ step :: Monad m => (a -> Builder) -> Stream a -> Iteratee a m B.ByteString+ step b input = case input of+ EOF -> yield (B.empty) EOF+ Chunks [] -> continue (step b)+ Chunks (v:vs) -> yield (toByteString $ b v) (Chunks vs)
+ LICENSE view
@@ -0,0 +1,25 @@+The following license covers this documentation, and the source code, except+where otherwise indicated.++Copyright 2010, Thomas Sutton. All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++* Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++* Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ blaze-builder-enumerator.cabal view
@@ -0,0 +1,34 @@+Name : blaze-builder-enumerator+Version : 0.1+Synopsis : Use blaze-builder Builder's in an Iteratee.+Description :++ This package simplifies the process of using blaze-builder with the+ enumerator package by converting a function that constructs a Builder into+ an Iteratee.++Author : Thomas Sutton <me@thomas-sutton.id.au>+Maintainer : me@thomas-sutton.id.au+Copyright : Copyright (c) Thomas Sutton 2010+License : BSD3+License-file : LICENSE+Build-type : Simple+Cabal-version : >=1.6+Category : Data, Text, Enumerator+Stability : Experimental+Bug-reports : mailto:me@thomas-sutton.id.au+Homepage : http://github.com/thsutton/blaze-builder-enumerator++Source-repository head+ Type: git+ Location: https://github.com/thsutton/blaze-builder-enumerator.git++Library+ GHC-options: -Wall -fno-warn-unused-do-bind+ Build-depends:+ base >= 4 && < 5+ , blaze-builder >= 0.2 && < 0.3+ , bytestring >= 0.9 && < 0.10+ , enumerator >= 0.4 && < 0.5+ Exposed-modules:+ Blaze.ByteString.Builder.Enumerator