Commit 6dfe9771 authored by bos's avatar bos
Browse files

Expose unpackCString#

parent 4ec9aaa2
......@@ -191,6 +191,7 @@ module Data.Text
-- * Low level operations
, copy
, unpackCString#
) where
import Prelude (Char, Bool(..), Int, Maybe(..), String,
......@@ -220,7 +221,7 @@ import Data.Text.Encoding (decodeUtf8, encodeUtf8)
import Data.Text.Internal.Fusion (stream, reverseStream, unstream)
import Data.Text.Internal.Private (span_)
import Data.Text.Internal (Text(..), empty, firstf, mul, safe, text)
import Data.Text.Show (singleton, unpack)
import Data.Text.Show (singleton, unpack, unpackCString#)
import qualified Prelude as P
import Data.Text.Unsafe (Iter(..), iter, iter_, lengthWord16, reverseIter,
reverseIter_, unsafeHead, unsafeTail)
......
......@@ -17,6 +17,7 @@ module Data.Text.Show
(
singleton
, unpack
, unpackCString#
) where
import Control.Monad.ST (ST)
......@@ -41,7 +42,10 @@ unpack :: Text -> String
unpack = S.unstreamList . stream
{-# INLINE [1] unpack #-}
-- | /O(n)/ Convert a literal string into a Text. Subject to fusion.
-- | /O(n)/ Convert a literal string into a 'Text'. Subject to
-- fusion.
--
-- This is exposed solely for people writing GHC rewrite rules.
unpackCString# :: Addr# -> Text
unpackCString# addr# = unstream (S.streamCString# addr#)
{-# NOINLINE unpackCString# #-}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment