diff options
-rw-r--r-- | Pipes/Text.hs | 21 | ||||
-rw-r--r-- | Pipes/Text/IO.hs | 4 | ||||
-rw-r--r-- | changelog | 4 |
3 files changed, 19 insertions, 10 deletions
diff --git a/Pipes/Text.hs b/Pipes/Text.hs index 9f84429..e027d00 100644 --- a/Pipes/Text.hs +++ b/Pipes/Text.hs | |||
@@ -137,10 +137,10 @@ import Prelude hiding ( | |||
137 | 137 | ||
138 | * /I. Effectful Text/ | 138 | * /I. Effectful Text/ |
139 | 139 | ||
140 | This package provides @pipes@ utilities for /text streams/, understood as | 140 | This package provides @pipes@ utilities for /text streams/ or /character streams/, |
141 | streams of 'Text' chunks. The individual chunks are uniformly /strict/, and thus you | 141 | realized as streams of 'Text' chunks. The individual chunks are uniformly /strict/, |
142 | will generally want @Data.Text@ in scope. But the type @Producer Text m r@ as we | 142 | and thus you will generally want @Data.Text@ in scope. But the type |
143 | are using it is a sort of pipes equivalent of the lazy @Text@ type. | 143 | @Producer Text m r@ ,as we are using it, is a sort of /pipes/ equivalent of the lazy @Text@ type. |
144 | 144 | ||
145 | This particular module provides many functions equivalent in one way or another to | 145 | This particular module provides many functions equivalent in one way or another to |
146 | the pure functions in | 146 | the pure functions in |
@@ -210,7 +210,7 @@ import Prelude hiding ( | |||
210 | would drop the leading white space from each line. | 210 | would drop the leading white space from each line. |
211 | 211 | ||
212 | The lenses in this library are marked as /improper/; this just means that | 212 | The lenses in this library are marked as /improper/; this just means that |
213 | they don't admit all the operations of an ideal lens, but only "getting" and "focussing". | 213 | they don't admit all the operations of an ideal lens, but only /getting/ and /focusing/. |
214 | Just for this reason, though, the magnificent complexities of the lens libraries | 214 | Just for this reason, though, the magnificent complexities of the lens libraries |
215 | are a distraction. The lens combinators to keep in mind, the ones that make sense for | 215 | are a distraction. The lens combinators to keep in mind, the ones that make sense for |
216 | our lenses, are @view@ \/ @(^.)@), @over@ \/ @(%~)@ , and @zoom@. | 216 | our lenses, are @view@ \/ @(^.)@), @over@ \/ @(%~)@ , and @zoom@. |
@@ -252,7 +252,7 @@ import Prelude hiding ( | |||
252 | contain at the start. Then we might write something like this: | 252 | contain at the start. Then we might write something like this: |
253 | 253 | ||
254 | > obey :: Monad m => Producer Text m b -> Producer Text m b | 254 | > obey :: Monad m => Producer Text m b -> Producer Text m b |
255 | > obey p = do (ts, p') <- lift $ runStateT (zoom (Text.splitAt 8) drawAll) p | 255 | > obey p = do (ts, p') <- lift $ runStateT (zoom (Text.splitAt 7) drawAll) p |
256 | > let seven = T.concat ts | 256 | > let seven = T.concat ts |
257 | > case T.toUpper seven of | 257 | > case T.toUpper seven of |
258 | > "TOUPPER" -> p' >-> Text.toUpper | 258 | > "TOUPPER" -> p' >-> Text.toUpper |
@@ -260,6 +260,11 @@ import Prelude hiding ( | |||
260 | > _ -> do yield seven | 260 | > _ -> do yield seven |
261 | > p' | 261 | > p' |
262 | 262 | ||
263 | |||
264 | > >>> let doc = each ["toU","pperTh","is document.\n"] | ||
265 | > >>> runEffect $ obey doc >-> Text.stdout | ||
266 | > THIS DOCUMENT. | ||
267 | |||
263 | The purpose of exporting lenses is the mental economy achieved with this three-way | 268 | The purpose of exporting lenses is the mental economy achieved with this three-way |
264 | applicability. That one expression, e.g. @lines@ or @splitAt 17@ can have these | 269 | applicability. That one expression, e.g. @lines@ or @splitAt 17@ can have these |
265 | three uses is no more surprising than that a pipe can act as a function modifying | 270 | three uses is no more surprising than that a pipe can act as a function modifying |
@@ -314,7 +319,7 @@ import Prelude hiding ( | |||
314 | 319 | ||
315 | > join :: Monad m => Producer Text m (Producer m r) -> Producer m r | 320 | > join :: Monad m => Producer Text m (Producer m r) -> Producer m r |
316 | 321 | ||
317 | The return type of 'lines', 'words', 'chunksOf' and the other "splitter" functions, | 322 | The return type of 'lines', 'words', 'chunksOf' and the other /splitter/ functions, |
318 | @FreeT (Producer m Text) m r@ -- our @Texts m r@ -- is the type of (effectful) | 323 | @FreeT (Producer m Text) m r@ -- our @Texts m r@ -- is the type of (effectful) |
319 | lists of (effectful) texts. The type @([Text],r)@ might be seen to gather | 324 | lists of (effectful) texts. The type @([Text],r)@ might be seen to gather |
320 | together things of the forms: | 325 | together things of the forms: |
@@ -368,7 +373,7 @@ import Prelude hiding ( | |||
368 | of @FreeT (Producer Text m) m r@ is simply the 'effectful' version of this. | 373 | of @FreeT (Producer Text m) m r@ is simply the 'effectful' version of this. |
369 | 374 | ||
370 | The @Pipes.Group@ module, which can generally be imported without qualification, | 375 | The @Pipes.Group@ module, which can generally be imported without qualification, |
371 | provides many functions for working with things of type @FreeT (Producer a m) m r@ | 376 | provides many functions for working with things of type @FreeT (Producer a m) m r@. |
372 | In particular it conveniently exports the constructors for @FreeT@ and the associated | 377 | In particular it conveniently exports the constructors for @FreeT@ and the associated |
373 | @FreeF@ type -- a fancy form of @Either@, namely | 378 | @FreeF@ type -- a fancy form of @Either@, namely |
374 | 379 | ||
diff --git a/Pipes/Text/IO.hs b/Pipes/Text/IO.hs index 627582e..de49c7b 100644 --- a/Pipes/Text/IO.hs +++ b/Pipes/Text/IO.hs | |||
@@ -39,9 +39,9 @@ import Prelude hiding (readFile, writeFile) | |||
39 | 'stdin' and 'stdout'. Some caveats described below. | 39 | 'stdin' and 'stdout'. Some caveats described below. |
40 | 40 | ||
41 | The main points are as in | 41 | The main points are as in |
42 | <https://hackage.haskell.org/package/pipes-bytestring-1.0.0/docs/Pipes-ByteString.html Pipes.ByteString> | 42 | <https://hackage.haskell.org/package/pipes-bytestring-1.0.0/docs/Pipes-ByteString.html Pipes.ByteString>: |
43 | 43 | ||
44 | An 'IO.Handle' can be associated with a 'Producer' or 'Consumer' according | 44 | A 'Handle' can be associated with a 'Producer' or 'Consumer' according |
45 | as it is read or written to. | 45 | as it is read or written to. |
46 | 46 | ||
47 | > import Pipes | 47 | > import Pipes |
@@ -1,3 +1,7 @@ | |||
1 | # Version 0.0.0.9 | ||
2 | |||
3 | * Documentation changes. | ||
4 | |||
1 | # Version 0.0.0.7 | 5 | # Version 0.0.0.7 |
2 | 6 | ||
3 | * Used the new text-stream-decoding package | 7 | * Used the new text-stream-decoding package |