@@ -3,6 +3,7 @@
33#if __GLASGOW_HASKELL__ >= 702
44{-# LANGUAGE Trustworthy #-}
55#endif
6+{-# LANGUAGE MonoLocalBinds #-}
67
78-- |
89-- Module : Data.Text
@@ -205,6 +206,7 @@ import Data.Char (isSpace)
205206import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), constrIndex,
206207 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
207208import Control.Monad (foldM)
209+import Control.Monad.ST (ST)
208210import qualified Data.Text.Array as A
209211import qualified Data.List as L
210212import Data.Monoid (Monoid(..))
@@ -441,6 +443,7 @@ append a@(Text arr1 off1 len1) b@(Text arr2 off2 len2)
441443 | otherwise = overflowError "append"
442444 where
443445 len = len1+len2
446+ x :: ST s (A.MArray s)
444447 x = do
445448 arr <- A.new len
446449 A.copyI arr 0 arr1 off1 len1
@@ -642,6 +645,7 @@ replace needle@(Text _ _ neeLen)
642645 where
643646 ixs = indices needle haystack
644647 len = hayLen - (neeLen - repLen) `mul` L.length ixs
648+ x :: ST s (A.MArray s)
645649 x = do
646650 marr <- A.new len
647651 let loop (i:is) o d = do
@@ -852,6 +856,7 @@ concat ts = case ts' of
852856 where
853857 ts' = L.filter (not . null) ts
854858 len = sumP "concat" $ L.map lengthWord16 ts'
859+ go :: ST s (A.MArray s)
855860 go = do
856861 arr <- A.new len
857862 let step i (Text a o l) =
@@ -965,6 +970,7 @@ replicate n t@(Text a o l)
965970 | otherwise = Text (A.run x) 0 len
966971 where
967972 len = l `mul` n
973+ x :: ST s (A.MArray s)
968974 x = do
969975 arr <- A.new len
970976 let loop !d !i | i >= n = return arr
@@ -1668,6 +1674,7 @@ overflowError fun = P.error $ "Data.Text." ++ fun ++ ": size overflow"
16681674copy :: Text -> Text
16691675copy (Text arr off len) = Text (A.run go) 0 len
16701676 where
1677+ go :: ST s (A.MArray s)
16711678 go = do
16721679 marr <- A.new len
16731680 A.copyI marr 0 arr off len