]> git.immae.eu Git - github/fretlink/text-pipes.git/commitdiff
a little more documentation
authormichaelt <what_is_it_to_do_anything@yahoo.com>
Sat, 5 Oct 2013 02:40:44 +0000 (22:40 -0400)
committermichaelt <what_is_it_to_do_anything@yahoo.com>
Sat, 5 Oct 2013 02:40:44 +0000 (22:40 -0400)
Data/Text/Pipes.hs

index e9b5488ed902cae4899f8cf63bb7f9643802ba4d..f972d2d505ed57c3ceca6521a0ff08b1a7d93644 100644 (file)
@@ -205,7 +205,8 @@ stdin :: MonadIO m => Producer' Text m ()
 stdin = fromHandle IO.stdin
 {-# INLINABLE stdin #-}
 
 stdin = fromHandle IO.stdin
 {-# INLINABLE stdin #-}
 
--- | Convert a 'IO.Handle' into a byte stream using a default chunk size
+-- | Convert a 'IO.Handle' into a text stream using a chunk size 
+-- determined by the good sense of the text library. 
 fromHandle :: MonadIO m => IO.Handle -> Producer' Text m ()
 fromHandle h = go where
     go = do txt <- liftIO (T.hGetChunk h)
 fromHandle :: MonadIO m => IO.Handle -> Producer' Text m ()
 fromHandle h = go where
     go = do txt <- liftIO (T.hGetChunk h)
@@ -213,6 +214,16 @@ fromHandle h = go where
                                      go
 {-# INLINABLE fromHandle#-}
 
                                      go
 {-# INLINABLE fromHandle#-}
 
+{-| Stream text from a file using Pipes.Safe
+
+>>> runSafeT $ runEffect $ readFile "README.md" >-> map toUpper >-> hoist lift stdout
+TEXT-PIPES
+==========
+TEXT PIPES, SOMEHOW TO BE FUSED WITH `PIPES-TEXT`.
+...
+>>>
+-}
+
 readFile :: (MonadSafe m, Base m ~ IO) => FilePath -> Producer' Text m ()
 readFile file = Safe.withFile file IO.ReadMode fromHandle
 {-# INLINABLE readFile #-}
 readFile :: (MonadSafe m, Base m ~ IO) => FilePath -> Producer' Text m ()
 readFile file = Safe.withFile file IO.ReadMode fromHandle
 {-# INLINABLE readFile #-}