@@ -3,6 +3,7 @@
3#if __GLASGOW_HASKELL__ >= 702
3#if __GLASGOW_HASKELL__ >= 702
4{-# LANGUAGE Trustworthy #-}
4{-# LANGUAGE Trustworthy #-}
6+{-# LANGUAGE MonoLocalBinds #-}
8-- Module : Data.Text
9-- Module : Data.Text
@@ -205,6 +206,7 @@ import Data.Char (isSpace)
205import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), constrIndex,
206import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), constrIndex,
206 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
207 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
207import Control.Monad (foldM)
208import Control.Monad (foldM)
209+import Control.Monad.ST (ST)
208import qualified Data.Text.Array as A
210import qualified Data.Text.Array as A
209import qualified Data.List as L
211import qualified Data.List as L
210import Data.Monoid (Monoid(..))
212import Data.Monoid (Monoid(..))
@@ -441,6 +443,7 @@ append a@(Text arr1 off1 len1) b@(Text arr2 off2 len2)
441 | otherwise = overflowError "append"
443 | otherwise = overflowError "append"
443 len = len1+len2
445 len = len1+len2
446+ x :: ST s (A.MArray s)
445 arr <- A.new len
448 arr <- A.new len
446 A.copyI arr 0 arr1 off1 len1
449 A.copyI arr 0 arr1 off1 len1
@@ -642,6 +645,7 @@ replace needle@(Text _ _ neeLen)
643 ixs = indices needle haystack
646 ixs = indices needle haystack
644 len = hayLen - (neeLen - repLen) `mul` L.length ixs
647 len = hayLen - (neeLen - repLen) `mul` L.length ixs
648+ x :: ST s (A.MArray s)
646 marr <- A.new len
650 marr <- A.new len
647 let loop (i:is) o d = do
651 let loop (i:is) o d = do
@@ -852,6 +856,7 @@ concat ts = case ts' of
853 ts' = L.filter (not . null) ts
857 ts' = L.filter (not . null) ts
854 len = sumP "concat" $ L.map lengthWord16 ts'
858 len = sumP "concat" $ L.map lengthWord16 ts'
859+ go :: ST s (A.MArray s)
856 arr <- A.new len
861 arr <- A.new len
857 let step i (Text a o l) =
862 let step i (Text a o l) =
@@ -965,6 +970,7 @@ replicate n t@(Text a o l)
965 | otherwise = Text (A.run x) 0 len
970 | otherwise = Text (A.run x) 0 len
967 len = l `mul` n
972 len = l `mul` n
973+ x :: ST s (A.MArray s)
969 arr <- A.new len
975 arr <- A.new len
970 let loop !d !i | i >= n = return arr
976 let loop !d !i | i >= n = return arr
@@ -1668,6 +1674,7 @@ overflowError fun = P.error $ "Data.Text." ++ fun ++ ": size overflow"
1668copy :: Text -> Text
1674copy :: Text -> Text
1669copy (Text arr off len) = Text (A.run go) 0 len
1675copy (Text arr off len) = Text (A.run go) 0 len
1677+ go :: ST s (A.MArray s)
1672 marr <- A.new len
1679 marr <- A.new len
1673 A.copyI marr 0 arr off len
1680 A.copyI marr 0 arr off len