@@ -24,6 +24,9 @@
25module Data.Text
25module Data.Text
27+ -- * Strict vs lazy types
27 -- * Fusion
30 -- * Fusion
28 -- $fusion
31 -- $fusion
@@ -203,8 +206,30 @@ import qualified Data.Text.Encoding.Utf16 as U16
203import Data.Text.Search (indices)
206import Data.Text.Search (indices)
204#if defined(__HADDOCK__)
207#if defined(__HADDOCK__)
205import Data.ByteString (ByteString)
208import Data.ByteString (ByteString)
209+import qualified Data.Text.Lazy as L
210+import Data.Int (Int64)
215+-- This package provides both strict and lazy 'Text' types. The
216+-- strict type is provided by the 'Data.Text' package, while the lazy
217+-- type is provided by the 'Data.Text.Lazy' package. Internally, the
218+-- lazy @Text@ type consists of a list of strict chunks.
220+-- The strict 'Text' type requires that an entire string fit into
221+-- memory at once. The lazy @Text@ type is capable of streaming
222+-- strings that are larger than memory using a small memory footprint.
223+-- In many cases, the overhead of chunked streaming makes the lazy
224+-- @Text@ type slower than its strict counterpart, but this is not
225+-- always the case. Sometimes, the time complexity of a function in
226+-- one module may be different from the other, due to their differing
227+-- internal structures.
229+-- Each module provides an almost identical API, with the main
230+-- difference being that the strict module uses 'Int' values for
231+-- lengths and counts, while the lazy module uses 'Int64' lengths.
208-- $fusion
233-- $fusion
210-- Most of the functions in this module are subject to /fusion/,
235-- Most of the functions in this module are subject to /fusion/,