Skip to content

Commit

Permalink
renamed 'Text.Blaze' to 'Blaze.ByteString'
Browse files Browse the repository at this point in the history
  • Loading branch information
meiersi committed Nov 4, 2010
1 parent 815a338 commit a7bbf4a
Show file tree
Hide file tree
Showing 24 changed files with 93 additions and 93 deletions.
8 changes: 4 additions & 4 deletions CHANGES
@@ -1,15 +1,15 @@

* blaze-builder-0.2.0.0

Heavily restructured 'blaze-builder' such that 'Text.Blaze.Builder' serves as
Heavily restructured 'blaze-builder' such that 'Blaze.ByteString.Builder' serves as
a drop-in replacement of 'binary:Data.Binary.Builder' which it improves upon
with respect to both speed as well as expressivity. See the documentation and
the benchmarks for details on improvements and new functionality.

Changed module structure:
Text.Blaze.Builder.Core -> Text.Blaze.Builder
Text.Blaze.Builder.Utf8 -> Text.Blaze.Builder.Char.Utf8
Text.Blaze.Builder.Html -> Text.Blaze.Builder.Html.Utf8
Blaze.ByteString.Builder.Core -> Blaze.ByteString.Builder
Blaze.ByteString.Builder.Utf8 -> Blaze.ByteString.Builder.Char.Utf8
Blaze.ByteString.Builder.Html -> Blaze.ByteString.Builder.Html.Utf8

Changed function names:
writeByte -> writeWord8
Expand Down
4 changes: 2 additions & 2 deletions Criterion/ScalingBenchmark.hs
Expand Up @@ -25,8 +25,8 @@ import Data.Int (Int64)

import qualified Data.Vector.Generic as V

import Text.Blaze.Builder
import Text.Blaze.Builder.Internal
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Internal

import qualified Data.Binary.Builder as B

Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -23,7 +23,7 @@ or run the list serialization comparison benchmark

make bench-blaze-vs-binary

Checkout the combinators in the module "Text.Blaze.Builder.Write" to see
Checkout the combinators in the module "Blaze.ByteString.Builder.Write" to see
the improvements in expressivity. This module allows to incorporate efficient
primitive buffer manipulations as parts of a builder. We use this facility
in the 'blaze-html' HTML templating library to allow for the efficient
Expand Down
2 changes: 1 addition & 1 deletion TODO
Expand Up @@ -2,7 +2,7 @@
* custom serialization functions for lists of 'WordX's
- benchmark chunk size speedup for more complicated computations of list
elements => to be expected that we get no speedup anymore or even a
slowdown => adapt Text.Blaze.Builder.Word accordingly.
slowdown => adapt Blaze.ByteString.Builder.Word accordingly.

* fast serialization for 'Text' values (currently unpacking to 'String' is
the fastest :-/)
Expand Down
32 changes: 16 additions & 16 deletions Text/Blaze/Builder.hs
@@ -1,32 +1,32 @@
-----------------------------------------------------------------------------
-- |
-- Module : Text.Blaze.Builder
-- Module : Blaze.ByteString.Builder
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Simon Meier <iridcode@gmail.com>
-- Stability : experimental
-- Portability : tested on GHC only
--
-- "Text.Blaze.Builder" is the main module, which you should import as a user
-- "Blaze.ByteString.Builder" is the main module, which you should import as a user
-- of the @blaze-builder@ library.
--
-- > import Text.Blaze.Builder
-- > import Blaze.ByteString.Builder
--
-- It provides you with a type 'Builder' that allows to efficiently construct
-- lazy bytestrings with a large average chunk size.
--
-- Intuitively, a 'Builder' denotes the construction of a part of a lazy
-- bytestring. Builders can either be created using one of the primitive
-- combinators in "Text.Blaze.Builder.Write" or by using one of the predefined
-- combinators in "Blaze.ByteString.Builder.Write" or by using one of the predefined
-- combinators for standard Haskell values (see the exposed modules of this
-- package). Concatenation of builders is done using 'mappend' from the
-- 'Monoid' typeclass.
--
-- Here is a small example that serializes a list of strings using the UTF-8
-- encoding.
--
-- @ import "Text.Blaze.Builder.Char.Utf8"@
-- @ import "Blaze.ByteString.Builder.Char.Utf8"@
--
-- > strings :: [String]
-- > strings = replicate 10000 "Hello there!"
Expand Down Expand Up @@ -56,16 +56,16 @@
-- expressivity.
-----------------------------------------------------------------------------

module Text.Blaze.Builder
module Blaze.ByteString.Builder
(
-- * The @Builder@ type
Builder

-- * Creating builders
, module Text.Blaze.Builder.Write
, module Text.Blaze.Builder.Int
, module Text.Blaze.Builder.Word
, module Text.Blaze.Builder.ByteString
, module Blaze.ByteString.Builder.Write
, module Blaze.ByteString.Builder.Int
, module Blaze.ByteString.Builder.Word
, module Blaze.ByteString.Builder.ByteString
, flush

-- * Executing builders
Expand All @@ -78,7 +78,7 @@ module Text.Blaze.Builder

-- * Compatibility to Data.Binary.Builder from the binary package
--
-- | The following functions ensure that @"Text.Blaze.Builder"@ is a
-- | The following functions ensure that @"Blaze.ByteString.Builder"@ is a
-- drop-in replacement for @Data.Binary.Builder@ from the @binary@
-- package. Note that these functions are deprecated and may be removed
-- in future versions of the @blaze-builder@ package.
Expand All @@ -99,11 +99,11 @@ module Text.Blaze.Builder
, putWord64host --
) where

import Text.Blaze.Builder.Internal
import Text.Blaze.Builder.Write
import Text.Blaze.Builder.Int
import Text.Blaze.Builder.Word
import Text.Blaze.Builder.ByteString
import Blaze.ByteString.Builder.Internal
import Blaze.ByteString.Builder.Write
import Blaze.ByteString.Builder.Int
import Blaze.ByteString.Builder.Word
import Blaze.ByteString.Builder.ByteString

import Data.Monoid
import Data.Word
Expand Down
8 changes: 4 additions & 4 deletions Text/Blaze/Builder/ByteString.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP, BangPatterns, OverloadedStrings #-}

-- |
-- Module : Text.Blaze.Builder.ByteString
-- Module : Blaze.ByteString.Builder.ByteString
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
-- License : BSD3-style (see LICENSE)
--
Expand All @@ -17,7 +17,7 @@
-- > import qualified Data.ByteString as S
-- > import qualified Data.ByteString.Lazy as L
--
module Text.Blaze.Builder.ByteString
module Blaze.ByteString.Builder.ByteString
(
-- * Strict bytestrings
writeByteString
Expand All @@ -34,8 +34,8 @@ module Text.Blaze.Builder.ByteString

) where

import Text.Blaze.Builder.Write
import Text.Blaze.Builder.Internal
import Blaze.ByteString.Builder.Write
import Blaze.ByteString.Builder.Internal

import Foreign
import Data.Monoid
Expand Down
8 changes: 4 additions & 4 deletions Text/Blaze/Builder/Char/Utf8.hs
Expand Up @@ -2,7 +2,7 @@
-- ignore warning from 'import Data.Text.Encoding'

-- |
-- Module : Text.Blaze.Builder.Char.Utf8
-- Module : Blaze.ByteString.Builder.Char.Utf8
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
-- License : BSD3-style (see LICENSE)
--
Expand All @@ -13,7 +13,7 @@
-- 'Write's and 'Builder's for serializing Unicode characters using the UTF-8
-- encoding.
--
module Text.Blaze.Builder.Char.Utf8
module Blaze.ByteString.Builder.Char.Utf8
(
-- * Writing UTF-8 encoded characters to a buffer
writeChar
Expand All @@ -34,8 +34,8 @@ import qualified Data.Text.Encoding as TS -- imported for documentation lin
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Encoding as TS -- imported for documentation links

import Text.Blaze.Builder.Internal
import Text.Blaze.Builder.Write
import Blaze.ByteString.Builder.Internal
import Blaze.ByteString.Builder.Write

-- | Write a UTF-8 encoded Unicode character to a buffer.
--
Expand Down
10 changes: 5 additions & 5 deletions Text/Blaze/Builder/Html/Utf8.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
-- |
-- Module : Text.Blaze.Builder.Html.Utf8
-- Module : Blaze.ByteString.Builder.Html.Utf8
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
-- License : BSD3-style (see LICENSE)
--
Expand All @@ -15,9 +15,9 @@
-- templating libraries. If the 'Builder' from 'blaze-builder' replaces the
-- 'Data.Binary.Builder' implementation, this module will most likely keep its
-- place, as it provides a set of very specialized functions.
module Text.Blaze.Builder.Html.Utf8
module Blaze.ByteString.Builder.Html.Utf8
(
module Text.Blaze.Builder.Char.Utf8
module Blaze.ByteString.Builder.Char.Utf8

-- * Writing HTML escaped and UTF-8 encoded characters to a buffer
, writeHtmlEscapedChar
Expand All @@ -35,8 +35,8 @@ import Data.ByteString.Char8 () -- for the 'IsString' instance of bytesrings
import qualified Data.Text as TS
import qualified Data.Text.Lazy as TL

import Text.Blaze.Builder
import Text.Blaze.Builder.Char.Utf8
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char.Utf8

-- | Write a HTML escaped and UTF-8 encoded Unicode character to a bufffer.
--
Expand Down
12 changes: 6 additions & 6 deletions Text/Blaze/Builder/Int.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}
-- |
-- Module : Text.Blaze.Builder.Int
-- Module : Blaze.ByteString.Builder.Int
-- Copyright : (c) 2010 Simon Meier
--
-- License : BSD3-style (see LICENSE)
Expand All @@ -11,14 +11,14 @@
--
-- 'Write's and 'Builder's for serializing integers.
--
-- See "Text.Blaze.Builder.Word" for information about how to best write several
-- See "Blaze.ByteString.Builder.Word" for information about how to best write several
-- integers at once.
--
#if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__)
#include "MachDeps.h"
#endif

module Text.Blaze.Builder.Int
module Blaze.ByteString.Builder.Int
(
-- * Writing integers to a buffer

Expand Down Expand Up @@ -79,9 +79,9 @@ module Text.Blaze.Builder.Int

) where

import Text.Blaze.Builder.Internal
import Text.Blaze.Builder.Write
import Text.Blaze.Builder.Word
import Blaze.ByteString.Builder.Internal
import Blaze.ByteString.Builder.Write
import Blaze.ByteString.Builder.Word

import Foreign

Expand Down
16 changes: 8 additions & 8 deletions Text/Blaze/Builder/Internal.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP, BangPatterns #-}
-- |
-- Module : Text.Blaze.Builder.Internal
-- Module : Blaze.ByteString.Builder.Internal
-- Copyright : (c) 2010 Simon Meier
-- License : BSD3-style (see LICENSE)
--
Expand All @@ -11,14 +11,14 @@
-- Implementation of the 'Builder' monoid.
--
-- A standard library user must never import this module directly. Instead, he
-- should import "Text.Blaze.Builder", which re-exports the 'Builder' type and
-- should import "Blaze.ByteString.Builder", which re-exports the 'Builder' type and
-- its associated public functions defined in this module.
--
-- Developers of other libraries may import this module to gain access to the
-- internal representation of builders. For example, in some cases, creating a
-- 'Builder' with a custom low-level 'BuildStep' may improve performance
-- considerably compared to the creating it using the public 'Builder'
-- combinators (e.g., @'fromWrite1List'@ in "Text.Blaze.Builder.Write").
-- combinators (e.g., @'fromWrite1List'@ in "Blaze.ByteString.Builder.Write").
-- Another example, is the use of 'ModifyChunks' to efficiently wire the
-- 'Builder' type with another library that generates lazy bytestrings.
--
Expand All @@ -27,7 +27,7 @@
-- implementation and the guarantees given in this file may change in any
-- version! The release notes will tell, if this was the case.
--
module Text.Blaze.Builder.Internal
module Blaze.ByteString.Builder.Internal
(
-- * The @Builder@ type
Builder(..)
Expand Down Expand Up @@ -75,10 +75,10 @@ import qualified Data.ByteString.Lazy.Internal as L
-- | Intuitively, a builder denotes the construction of a lazy bytestring.
--
-- Builders can be created from primitive buffer manipulations using the
-- @'Write'@ abstraction provided by in "Text.Blaze.Builder.Write". However for
-- @'Write'@ abstraction provided by in "Blaze.ByteString.Builder.Write". However for
-- many Haskell values, there exist predefined functions doing that already.
-- For example, UTF-8 encoding 'Char' and 'String' values is provided by the
-- functions in "Text.Blaze.Builder.Char.Utf8". Concatenating builders is done
-- functions in "Blaze.ByteString.Builder.Char.Utf8". Concatenating builders is done
-- using their 'Monoid' instance.
--
-- Semantically, builders are nothing special. They just denote a sequence of
Expand All @@ -94,7 +94,7 @@ import qualified Data.ByteString.Lazy.Internal as L
-- benchmarking is unavoidable. Moreover, it also helps to understand the
-- implementation of builders and the predefined combinators. This should be
-- amenable to the average Haskell programmer by reading the source code of
-- "Text.Blaze.Builder.Internal" and the other modules of this library.
-- "Blaze.ByteString.Builder.Internal" and the other modules of this library.
--
-- The guiding implementation principle was to reduce the abstraction cost per
-- output byte. We use continuation passing to achieve a constant time append.
Expand All @@ -105,7 +105,7 @@ import qualified Data.ByteString.Lazy.Internal as L
-- We also try to take the pressure off the cache by moving variables as far
-- out of loops as possible. This leads to some duplication of code, but
-- results in sometimes dramatic increases in performance. For example, see the
-- @'fromWord8s'@ function in "Text.Blaze.Builder.Word".
-- @'fromWord8s'@ function in "Blaze.ByteString.Builder.Word".
--
newtype Builder = Builder (BuildStep -> BuildStep)

Expand Down
8 changes: 4 additions & 4 deletions Text/Blaze/Builder/Word.hs
Expand Up @@ -3,7 +3,7 @@

{-# LANGUAGE CPP #-}
-- |
-- Module : Text.Blaze.Builder.Word
-- Module : Blaze.ByteString.Builder.Word
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
--
-- Original serialization code from 'Data.Binary.Builder':
Expand Down Expand Up @@ -35,7 +35,7 @@
#include "MachDeps.h"
#endif

module Text.Blaze.Builder.Word
module Blaze.ByteString.Builder.Word
(
-- * Writing words to a buffer

Expand Down Expand Up @@ -96,8 +96,8 @@ module Text.Blaze.Builder.Word

) where

import Text.Blaze.Builder.Internal
import Text.Blaze.Builder.Write
import Blaze.ByteString.Builder.Internal
import Blaze.ByteString.Builder.Write

import Foreign

Expand Down
8 changes: 4 additions & 4 deletions Text/Blaze/Builder/Write.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP, BangPatterns #-}

-- |
-- Module : Text.Blaze.Builder.Write
-- Module : Blaze.ByteString.Builder.Write
-- Copyright : (c) 2010 Jasper Van der Jeugt & Simon Meier
-- License : BSD3-style (see LICENSE)
--
Expand All @@ -13,7 +13,7 @@
-- buffer. 'Write's form the public interface for lifting direct buffer
-- manipulations to 'Builder's.
--
module Text.Blaze.Builder.Write
module Blaze.ByteString.Builder.Write
(
-- * Atomic writes to a buffer
Write (..)
Expand All @@ -29,7 +29,7 @@ module Text.Blaze.Builder.Write

) where

import Text.Blaze.Builder.Internal
import Blaze.ByteString.Builder.Internal

import Foreign
import Data.Monoid
Expand All @@ -45,7 +45,7 @@ import Data.Monoid
-- must ensure that @n@ bytes are free starting from @pf@.
--
-- For example, the function @'writeWord8'@ provided by
-- "Text.Blaze.Builder.Word" creates a 'Write' that writes a single fixed byte
-- "Blaze.ByteString.Builder.Word" creates a 'Write' that writes a single fixed byte
-- to a buffer.
--
-- > writeWord8 :: Word8 -> Write
Expand Down

0 comments on commit a7bbf4a

Please sign in to comment.