More modules that need LANGUAGE BangPatterns
[ghc-hetmet.git] / compiler / utils / StringBuffer.lhs
index 2b3b775..5d1bfa6 100644 (file)
@@ -6,6 +6,7 @@
 Buffers for scanning string input stored in external arrays.
 
 \begin{code}
+{-# LANGUAGE BangPatterns #-}
 {-# OPTIONS_GHC -O -funbox-strict-fields #-}
 -- We always optimise this, otherwise performance of a non-optimised
 -- compiler is severely affected
@@ -138,8 +139,9 @@ appendStringBuffers sb1 sb2
           calcLen sb = len sb - cur sb
           size =  sb1_len + sb2_len
 
-stringToStringBuffer :: String -> IO StringBuffer
-stringToStringBuffer str = do
+stringToStringBuffer :: String -> StringBuffer
+stringToStringBuffer str =
+ unsafePerformIO $ do
   let size = utf8EncodedLength str
   buf <- mallocForeignPtrArray (size+3)
   withForeignPtr buf $ \ptr -> do