Commit 3c171430 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Use BS.pack instead of mkFastBytesByteList

parent fae0d4c0
......@@ -30,6 +30,7 @@ import Util
import FastString
import Outputable
import qualified Data.ByteString as BS
import Control.Monad( unless )
import Language.Haskell.TH as TH hiding (sigP)
......@@ -752,7 +753,7 @@ cvtLit (CharL c) = do { force c; return $ HsChar c }
cvtLit (StringL s) = do { let { s' = mkFastString s }
; force s'
; return $ HsString s' }
cvtLit (StringPrimL s) = do { let { s' = mkFastBytesByteList s }
cvtLit (StringPrimL s) = do { let { s' = BS.pack s }
; force s'
; return $ HsStringPrim s' }
cvtLit _ = panic "Convert.cvtLit: Unexpected literal"
......
......@@ -32,7 +32,6 @@ module FastString
foreignPtrToFastBytes,
fastStringToFastBytes,
fastZStringToByteString,
mkFastBytesByteList,
unsafeMkFastBytesString,
hashFB,
......@@ -145,15 +144,6 @@ fastStringToFastBytes f = fs_fb f
fastZStringToByteString :: FastZString -> ByteString
fastZStringToByteString (FastZString bs) = bs
mkFastBytesByteList :: [Word8] -> FastBytes
mkFastBytesByteList bs =
inlinePerformIO $ do
let l = Prelude.length bs
buf <- mallocForeignPtrBytes l
withForeignPtr buf $ \ptr -> do
pokeArray (castPtr ptr) bs
return $ foreignPtrToFastBytes buf l
-- This will drop information if any character > '\xFF'
unsafeMkFastBytesString :: String -> FastBytes
unsafeMkFastBytesString str =
......
Markdown is supported
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