Commits

Bryan O'Sullivan committed 6228517

Drop restreamUtf8 function that is no longer used (gh-44)

Comments (0)

Files changed (1)

Data/Text/Encoding/Fusion/Common.hs

     -- * Restreaming
     -- Restreaming is the act of converting from one 'Stream'
     -- representation to another.
-      restreamUtf8
-    , restreamUtf16LE
+      restreamUtf16LE
     , restreamUtf16BE
     , restreamUtf32LE
     , restreamUtf32BE
 import Data.Text.UnsafeChar (ord)
 import Data.Text.UnsafeShift (shiftR)
 import Data.Word (Word8)
-import qualified Data.Text.Encoding.Utf8 as U8
-
--- | /O(n)/ Convert a Stream Char into a UTF-8 encoded Stream Word8.
-restreamUtf8 :: Stream Char -> Stream Word8
-restreamUtf8 (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2)
-  where
-    next (RS0 s) = case next0 s of
-        Done              -> Done
-        Skip s'           -> Skip (RS0 s')
-        Yield x s'
-            | n <= 0x7F   -> Yield c  (RS0 s')
-            | n <= 0x07FF -> Yield a2 (RS1 s' b2)
-            | n <= 0xFFFF -> Yield a3 (RS2 s' b3 c3)
-            | otherwise   -> Yield a4 (RS3 s' b4 c4 d4)
-          where
-            n  = ord x
-            c  = fromIntegral n
-            (a2,b2) = U8.ord2 x
-            (a3,b3,c3) = U8.ord3 x
-            (a4,b4,c4,d4) = U8.ord4 x
-    next (RS1 s x2)       = Yield x2 (RS0 s)
-    next (RS2 s x2 x3)    = Yield x2 (RS1 s x3)
-    next (RS3 s x2 x3 x4) = Yield x2 (RS2 s x3 x4)
-    {-# INLINE next #-}
-{-# INLINE restreamUtf8 #-}
 
 restreamUtf16BE :: Stream Char -> Stream Word8
 restreamUtf16BE (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.