From 02f89dfe9b4787fbad5f3740ed1626203c474a2b Mon Sep 17 00:00:00 2001 From: michaelt Date: Mon, 17 Feb 2014 22:58:57 -0500 Subject: version 0.0.0.8 fwiw --- Pipes/Text.hs | 16 +++++++++------- Pipes/Text/Encoding.hs | 2 +- README.md | 4 ++-- pipes-text.cabal | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Pipes/Text.hs b/Pipes/Text.hs index d5b93f1..2f69806 100644 --- a/Pipes/Text.hs +++ b/Pipes/Text.hs @@ -1,7 +1,7 @@ {-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Trustworthy #-} {-| This package provides @pipes@ utilities for \'text streams\', which are - streams of 'Text' chunks. The individual chunks are uniformly @strict@, and you + 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@ is in some ways the pipes equivalent of the lazy @Text@ type. @@ -9,8 +9,8 @@ the 'pure' functions in . They transform, divide, group and fold text streams. Though @Producer Text m r@ - is \'effectful\' Text, functions - in this module are \'pure\' in the sense that they are uniformly monad-independent. + is the type of \'effectful Text\', the functions in this module are \'pure\' + in the sense that they are uniformly monad-independent. Simple IO operations are defined in @Pipes.Text.IO@ -- as lazy IO @Text@ operations are in @Data.Text.Lazy.IO@. Interoperation with @ByteString@ is provided in @Pipes.Text.Encoding@, which parallels @Data.Text.Lazy.Encoding@. @@ -49,7 +49,10 @@ sense.) Each such expression, e.g. 'lines', 'chunksOf' or 'splitAt', reduces to the - intuitively corresponding function when used with @view@ or @(^.)@. + intuitively corresponding function when used with @view@ or @(^.)@. The lens combinators + you will find indispensible are \'view\'/ '(^.)', 'zoom' and probably 'over', which + are supplied by both and + A more important difference the example reveals is in the types closely associated with the central type, @Producer Text m r@. In @Data.Text@ and @Data.Text.Lazy@ @@ -62,15 +65,14 @@ which relate a Text with a pair or list of Texts. The corresponding functions here (taking account of \'lensification\') are -> view . splitAt :: (Monad m, Integral n) -> => n -> Producer Text m r -> Producer Text.Text m (Producer Text.Text m r) +> view . splitAt :: (Monad m, Integral n) => n -> Producer Text m r -> Producer Text.Text m (Producer Text.Text m r) > view lines :: Monad m => Producer Text m r -> FreeT (Producer Text m) m r > view . chunksOf :: (Monad m, Integral n) => n -> Producer Text m r -> FreeT (Producer Text m) m r In the type @Producer Text m (Producer Text m r)@ the second element of the \'pair\' of of \'effectful Texts\' cannot simply be retrieved with 'snd'. This is an \'effectful\' pair, and one must work through the effects - of the first element to arrive at the second. Similarly in @FreeT (Producer Text m) m r@, + of the first element to arrive at the second Text stream. Similarly in @FreeT (Producer Text m) m r@, which corresponds with @[Text]@, on cannot simply drop 10 Producers and take the others; we can only get to the ones we want to take by working through their predecessors. diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs index a1a0113..e6fc6bf 100644 --- a/Pipes/Text/Encoding.hs +++ b/Pipes/Text/Encoding.hs @@ -189,7 +189,7 @@ mkCodec dec enc = \k p0 -> fmap (\p -> join (for p (yield . enc))) (k (dec p0)) > decode utf8 Byte.stdin :: Producer Text IO (Producer ByteString IO r) > Bytes.stdin ^. utf8 :: Producer Text IO (Producer ByteString IO r) - Uses of a codec with @view@ / @(^.)@ / 'decode' can always be replaced by the specialized + Uses of a codec with @view@ or @(^.)@ or 'decode' can always be replaced by the specialized decoding functions exported here, e.g. > decodeUtf8 :: Producer ByteString m r -> Producer Text m (Producer ByteString m r) diff --git a/README.md b/README.md index ff2bf1e..a950a67 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ pipes-text This package follows the rule: - `pipes-text : pipes-bytestring :: text : bytestring` + 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. +The division of three modules, `Pipes.Text` , `Pipes.Text.Encoding` and `Pipes.Text.IO` has more or less the significance it has in the `text` library. 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 diff --git a/pipes-text.cabal b/pipes-text.cabal index 3ced2bc..4158fed 100644 --- a/pipes-text.cabal +++ b/pipes-text.cabal @@ -1,7 +1,7 @@ name: pipes-text version: 0.0.0.8 synopsis: Text pipes. -description: * This package will be in a draft, or testing, phase until version 0.0.1. Please report any installation difficulties, or any wisdom about the api, on the github page! +description: * This package will be in a draft, or testing, phase until version 0.0.1. Please report any installation difficulties, or any wisdom about the api, on the github page or the . This organization of the package follows the rule . -- cgit v1.2.3