Skip to content

Commit cdc80a8

Browse files
committed
Use native (and naive) UTF8 decoder
1 parent 14c6ae1 commit cdc80a8

File tree

9 files changed

+175
-346
lines changed

9 files changed

+175
-346
lines changed

cbits/cbits.c

Lines changed: 0 additions & 160 deletions
This file was deleted.

include/text_cbits.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Data/Text.hs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ import qualified Data.Text.Internal.Fusion.Common as S
231231
import Data.Text.Encoding (decodeUtf8', encodeUtf8)
232232
import Data.Text.Internal.Fusion (stream, reverseStream, unstream)
233233
import Data.Text.Internal.Private (span_)
234-
import Data.Text.Internal (Text(..), empty, firstf, mul, safe, text)
234+
import Data.Text.Internal (Text(..), empty, firstf, mul, safe, text, append)
235235
import Data.Text.Internal.Unsafe.Char (unsafeWrite, unsafeChr8)
236236
import Data.Text.Show (singleton, unpack, unpackCString#)
237237
import qualified Prelude as P
@@ -446,24 +446,6 @@ snoc :: Text -> Char -> Text
446446
snoc t c = unstream (S.snoc (stream t) (safe c))
447447
{-# INLINE snoc #-}
448448

449-
-- | /O(n)/ Appends one 'Text' to the other by copying both of them
450-
-- into a new 'Text'.
451-
append :: Text -> Text -> Text
452-
append a@(Text arr1 off1 len1) b@(Text arr2 off2 len2)
453-
| len1 == 0 = b
454-
| len2 == 0 = a
455-
| len > 0 = Text (A.run x) 0 len
456-
| otherwise = overflowError "append"
457-
where
458-
len = len1+len2
459-
x :: ST s (A.MArray s)
460-
x = do
461-
arr <- A.new len
462-
A.copyI len1 arr 0 arr1 off1
463-
A.copyI len2 arr len1 arr2 off2
464-
return arr
465-
{-# NOINLINE append #-}
466-
467449
-- | /O(1)/ Returns the first character of a 'Text', which must be
468450
-- non-empty.
469451
head :: Text -> Char

0 commit comments

Comments
 (0)