I never looked into why, but you can observe that e.g. `fmap (decodeUtf8) . 
B.readFile` is several times as fast as `T.readFile` .  It's the same with 
the other material in `Data.Text.(Lazy.)IO`.  I think this is why he 
doesn't include the IO functions in `Data.Text`: the official IO is via 
ByteString using the encoding and decoding functions, same as with 
pipes-text


    import qualified Data.Text as T
    import qualified Data.Text.IO as T
    import qualified Data.Text.Encoding as T
    import qualified Data.ByteString.Char8 as B
    import System.Environment

    main = do
      x <- getArgs 
      case x of 
        [] -> do 
          txt <- T.readFile "txt/words3d.txt"
          print $ T.length txt
        _  ->  do
          bs <- B.readFile "txt/words3d.txt"
          print $ T.length (T.decodeUtf8 bs)

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to