From 13a43263ca34ae5124f630b5b5cefdde831596b3 Mon Sep 17 00:00:00 2001 From: michaelt Date: Fri, 4 Oct 2013 22:49:53 -0400 Subject: [PATCH] a little more documentation --- Data/Text/Pipes.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Data/Text/Pipes.hs b/Data/Text/Pipes.hs index f972d2d..e918585 100644 --- a/Data/Text/Pipes.hs +++ b/Data/Text/Pipes.hs @@ -1,14 +1,14 @@ {-# LANGUAGE RankNTypes, TypeFamilies #-} -{-| This module provides @pipes@ utilities for \"byte streams\", which are - streams of strict 'Text's chunks. Use byte streams to interact +{-| This module provides @pipes@ utilities for \"text streams\", which are + streams of strict 'Text' chunks. Use text streams to interact with both 'IO.Handle's and lazy 'Text's. To stream to or from 'IO.Handle's, use 'fromHandle' or 'toHandle'. For example, the following program copies data from one file to another: > import Pipes -> import qualified Pipes.Text as P +> import qualified Data.Text.Pipes as P > import System.IO > > main = @@ -16,6 +16,15 @@ > withFile "outFile.txt" WriteMode $ \hOut -> > runEffect $ P.fromHandle hIn >-> P.toHandle hOut + The following is the more Prelude-like and uses Pipes.Safe: + +> import Pipes +> import qualified Data.Text.Pipes as P +> import Pipes.Safe +> +> main = runSafeT $ runEffect $ P.readFile "inFile.txt" >-> P.writeFile "outFile.txt" + + You can stream to and from 'stdin' and 'stdout' using the predefined 'stdin' and 'stdout' proxies, like in the following \"echo\" program: -- 2.41.0