on master help sign in
Twiddle docs.
e99decfBryan O'Sullivan
Data/Text/Internal.hs+2
@@ -39,6 +39,7 @@ data Text = Text
39 {-# UNPACK #-} !Int -- length
39 {-# UNPACK #-} !Int -- length
40 deriving (Typeable)
40 deriving (Typeable)
41
41
42+-- | Smart constructor.
42text :: A.Array Word16 -> Int -> Int -> Text
43text :: A.Array Word16 -> Int -> Int -> Text
43text arr off len =
44text arr off len =
44 assert (len >= 0) .
45 assert (len >= 0) .
@@ -55,6 +56,7 @@ empty :: Text
55empty = Text A.empty 0 0
56empty = Text A.empty 0 0
56{-# INLINE [1] empty #-}
57{-# INLINE [1] empty #-}
57
58
59+-- | A useful 'show'-like function for debugging purposes.
58showText :: Text -> String
60showText :: Text -> String
59showText (Text arr off len) =
61showText (Text arr off len) =
60 "Text " ++ (show . take (off+len) . A.toList) arr ++ ' ' :
62 "Text " ++ (show . take (off+len) . A.toList) arr ++ ' ' :
Data/Text/Unsafe.hs+2−2
@@ -1,11 +1,11 @@
1-- |
1-- |
2-- Module : Data.Text.Unsafe
2-- Module : Data.Text.Unsafe
3−-- License : BSD-style
4-- Copyright : (c) Bryan O'Sullivan 2009
3-- Copyright : (c) Bryan O'Sullivan 2009
4+-- License : BSD-style
5-- Maintainer : bos@serpentine.com
5-- Maintainer : bos@serpentine.com
6-- Stability : experimental
6-- Stability : experimental
7-- Portability : portable
7-- Portability : portable
8−--
8+--
9-- A module containing unsafe 'Text' operations, for very very careful
9-- A module containing unsafe 'Text' operations, for very very careful
10-- use in heavily tested code.
10-- use in heavily tested code.
11module Data.Text.Unsafe
11module Data.Text.Unsafe