@@ -213,7 +213,7 @@ import qualified Data.Text.Internal.Fusion as S
213213import qualified Data.Text.Internal.Fusion.Common as S
214214import Data.Text.Internal.Fusion (stream, reverseStream, unstream)
215215import Data.Text.Internal.Private (span_)
216−import Data.Text.Internal (Text(..), empty, firstf, safe, text, textP)
216+import Data.Text.Internal (Text(..), empty, firstf, safe, textP)
217217import qualified Prelude as P
218218import Data.Text.Unsafe (Iter(..), iter, iter_, lengthWord16, reverseIter,
219219 reverseIter_, unsafeHead, unsafeTail)
@@ -1004,7 +1004,7 @@ take :: Int -> Text -> Text
10041004take n t@(Text arr off len)
10051005 | n <= 0 = empty
10061006 | n >= len = t
1007− | otherwise = text arr off (iterN n t)
1007+ | otherwise = textP arr off (iterN n t)
10081008{-# INLINE [1] take #-}
10091009
10101010iterN :: Int -> Text -> Int
@@ -1031,7 +1031,7 @@ takeEnd :: Int -> Text -> Text
10311031takeEnd n t@(Text arr off len)
10321032 | n <= 0 = empty
10331033 | n >= len = t
1034− | otherwise = text arr (off+i) (len-i)
1034+ | otherwise = textP arr (off+i) (len-i)
10351035 where i = iterNEnd n t
10361036
10371037iterNEnd :: Int -> Text -> Int
@@ -1049,7 +1049,7 @@ drop :: Int -> Text -> Text
10491049drop n t@(Text arr off len)
10501050 | n <= 0 = t
10511051 | n >= len = empty
1052− | otherwise = text arr (off+i) (len-i)
1052+ | otherwise = textP arr (off+i) (len-i)
10531053 where i = iterN n t
10541054{-# INLINE [1] drop #-}
10551055
@@ -1070,7 +1070,7 @@ dropEnd :: Int -> Text -> Text
10701070dropEnd n t@(Text arr off len)
10711071 | n <= 0 = t
10721072 | n >= len = empty
1073− | otherwise = text arr off (iterNEnd n t)
1073+ | otherwise = textP arr off (iterNEnd n t)
10741074
10751075-- | /O(n)/ 'takeWhile', applied to a predicate @p@ and a 'Text',
10761076-- returns the longest prefix (possibly empty) of elements that
@@ -1164,8 +1164,8 @@ splitAt :: Int -> Text -> (Text, Text)
11641164splitAt n t@(Text arr off len)
11651165 | n <= 0 = (empty, t)
11661166 | n >= len = (t, empty)
1167− | otherwise = (text arr off k, text arr (off+k) (len-k))
1168− where k = iterN n t
1167+ | otherwise = let k = iterN n t
1168+ in (textP arr off k, textP arr (off+k) (len-k))
11691169
11701170-- | /O(n)/ 'span', applied to a predicate @p@ and text @t@, returns
11711171-- a pair whose first element is the longest prefix (possibly empty)
@@ -1188,7 +1188,7 @@ groupBy p = loop
11881188 where
11891189 loop t@(Text arr off len)
11901190 | null t = []
1191− | otherwise = text arr off n : loop (text arr (off+n) (len-n))
1191+ | otherwise = textP arr off n : loop (textP arr (off+n) (len-n))
11921192 where Iter c d = iter t 0
11931193 n = d + findAIndexOrEnd (not . p c) (Text arr (off+d) (len-d))
11941194