diff options
author | michaelt <what_is_it_to_do_anything@yahoo.com> | 2014-02-16 11:49:22 -0500 |
---|---|---|
committer | michaelt <what_is_it_to_do_anything@yahoo.com> | 2014-02-16 11:49:22 -0500 |
commit | 3f76b550da195af30d32f611d55b33e0651cd0e8 (patch) | |
tree | 5de8f70d1ff1de1e6886ce64296da006327a60d4 | |
parent | dc6ce77408bd3239c64568834add83f6b4af0259 (diff) | |
download | text-pipes-3f76b550da195af30d32f611d55b33e0651cd0e8.tar.gz text-pipes-3f76b550da195af30d32f611d55b33e0651cd0e8.tar.zst text-pipes-3f76b550da195af30d32f611d55b33e0651cd0e8.zip |
readme
-rw-r--r-- | Pipes/Text/IO.hs | 6 | ||||
-rw-r--r-- | README.md | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Pipes/Text/IO.hs b/Pipes/Text/IO.hs index 43e636e..92500c3 100644 --- a/Pipes/Text/IO.hs +++ b/Pipes/Text/IO.hs | |||
@@ -60,7 +60,7 @@ import Prelude hiding (readFile, writeFile) | |||
60 | but uses the system encoding and has other nice @Data.Text.IO@ features | 60 | but uses the system encoding and has other nice @Data.Text.IO@ features |
61 | -} | 61 | -} |
62 | 62 | ||
63 | fromHandle :: MonadIO m => IO.Handle -> Producer' Text m () | 63 | fromHandle :: MonadIO m => IO.Handle -> Producer Text m () |
64 | fromHandle h = go where | 64 | fromHandle h = go where |
65 | go = do txt <- liftIO (T.hGetChunk h) | 65 | go = do txt <- liftIO (T.hGetChunk h) |
66 | if T.null txt then return () | 66 | if T.null txt then return () |
@@ -69,7 +69,7 @@ fromHandle h = go where | |||
69 | {-# INLINABLE fromHandle#-} | 69 | {-# INLINABLE fromHandle#-} |
70 | 70 | ||
71 | -- | Stream text from 'stdin' | 71 | -- | Stream text from 'stdin' |
72 | stdin :: MonadIO m => Producer' Text m () | 72 | stdin :: MonadIO m => Producer Text m () |
73 | stdin = fromHandle IO.stdin | 73 | stdin = fromHandle IO.stdin |
74 | {-# INLINE stdin #-} | 74 | {-# INLINE stdin #-} |
75 | 75 | ||
@@ -80,7 +80,7 @@ stdin = fromHandle IO.stdin | |||
80 | MAIN = PUTSTRLN "HELLO WORLD" | 80 | MAIN = PUTSTRLN "HELLO WORLD" |
81 | -} | 81 | -} |
82 | 82 | ||
83 | readFile :: MonadSafe m => FilePath -> Producer' Text m () | 83 | readFile :: MonadSafe m => FilePath -> Producer Text m () |
84 | readFile file = Safe.withFile file IO.ReadMode fromHandle | 84 | readFile file = Safe.withFile file IO.ReadMode fromHandle |
85 | {-# INLINE readFile #-} | 85 | {-# INLINE readFile #-} |
86 | 86 | ||
@@ -1,6 +1,10 @@ | |||
1 | pipes-text | 1 | pipes-text |
2 | ========== | 2 | ========== |
3 | 3 | ||
4 | This package follows the rule `pipes-text : pipes-bytestring :: text : bytestring` It has three modules, `Pipes.Text` , `Pipes.Text.Encoding` and `Pipes.Text.IO`; the division has more or less the significance it has in the `text` library. | 4 | This package follows the rule: |
5 | |||
6 | `pipes-text : pipes-bytestring :: text : bytestring` | ||
7 | |||
8 | It has three modules, `Pipes.Text` , `Pipes.Text.Encoding` and `Pipes.Text.IO`; the division has more or less the significance it has in the `text` library. | ||
5 | 9 | ||
6 | Note that the module `Pipes.Text.IO` uses version 0.11.3 or later of the `text` library. (It thus works with the version of `text` that came with the 2013 Haskell Platform. To use an older `text`, install with the flag `-fnoio` \ No newline at end of file | 10 | Note that the module `Pipes.Text.IO` uses version 0.11.3 or later of the `text` library. (It thus works with the version of `text` that came with the 2013 Haskell Platform. To use an older `text`, install with the flag `-fnoio` \ No newline at end of file |