From e1ed9621af63de22515a6b33bc78bb56daea4c29 Mon Sep 17 00:00:00 2001 From: michaelt Date: Sat, 1 Mar 2014 21:06:44 -0500 Subject: documentation nonsense --- Pipes/Text.hs | 21 +++++++++++++-------- Pipes/Text/IO.hs | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'Pipes') 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 ( * /I. Effectful Text/ - This package provides @pipes@ utilities for /text streams/, understood as - streams of 'Text' chunks. The individual chunks are uniformly /strict/, and thus you - will generally want @Data.Text@ in scope. But the type @Producer Text m r@ as we - are using it is a sort of pipes equivalent of the lazy @Text@ type. + This package provides @pipes@ utilities for /text streams/ or /character streams/, + realized as streams of 'Text' chunks. The individual chunks are uniformly /strict/, + and thus you will generally want @Data.Text@ in scope. But the type + @Producer Text m r@ ,as we are using it, is a sort of /pipes/ equivalent of the lazy @Text@ type. This particular module provides many functions equivalent in one way or another to the pure functions in @@ -210,7 +210,7 @@ import Prelude hiding ( would drop the leading white space from each line. The lenses in this library are marked as /improper/; this just means that - they don't admit all the operations of an ideal lens, but only "getting" and "focussing". + they don't admit all the operations of an ideal lens, but only /getting/ and /focusing/. Just for this reason, though, the magnificent complexities of the lens libraries are a distraction. The lens combinators to keep in mind, the ones that make sense for our lenses, are @view@ \/ @(^.)@), @over@ \/ @(%~)@ , and @zoom@. @@ -252,7 +252,7 @@ import Prelude hiding ( contain at the start. Then we might write something like this: > obey :: Monad m => Producer Text m b -> Producer Text m b -> obey p = do (ts, p') <- lift $ runStateT (zoom (Text.splitAt 8) drawAll) p +> obey p = do (ts, p') <- lift $ runStateT (zoom (Text.splitAt 7) drawAll) p > let seven = T.concat ts > case T.toUpper seven of > "TOUPPER" -> p' >-> Text.toUpper @@ -260,6 +260,11 @@ import Prelude hiding ( > _ -> do yield seven > p' + +> >>> let doc = each ["toU","pperTh","is document.\n"] +> >>> runEffect $ obey doc >-> Text.stdout +> THIS DOCUMENT. + The purpose of exporting lenses is the mental economy achieved with this three-way applicability. That one expression, e.g. @lines@ or @splitAt 17@ can have these three uses is no more surprising than that a pipe can act as a function modifying @@ -314,7 +319,7 @@ import Prelude hiding ( > join :: Monad m => Producer Text m (Producer m r) -> Producer m r - The return type of 'lines', 'words', 'chunksOf' and the other "splitter" functions, + The return type of 'lines', 'words', 'chunksOf' and the other /splitter/ functions, @FreeT (Producer m Text) m r@ -- our @Texts m r@ -- is the type of (effectful) lists of (effectful) texts. The type @([Text],r)@ might be seen to gather together things of the forms: @@ -368,7 +373,7 @@ import Prelude hiding ( of @FreeT (Producer Text m) m r@ is simply the 'effectful' version of this. The @Pipes.Group@ module, which can generally be imported without qualification, - provides many functions for working with things of type @FreeT (Producer a m) m r@ + provides many functions for working with things of type @FreeT (Producer a m) m r@. In particular it conveniently exports the constructors for @FreeT@ and the associated @FreeF@ type -- a fancy form of @Either@, namely 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) 'stdin' and 'stdout'. Some caveats described below. The main points are as in - + : - An 'IO.Handle' can be associated with a 'Producer' or 'Consumer' according + A 'Handle' can be associated with a 'Producer' or 'Consumer' according as it is read or written to. > import Pipes -- cgit v1.2.3