aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormichaelt <what_is_it_to_do_anything@yahoo.com>2014-02-17 22:58:57 -0500
committermichaelt <what_is_it_to_do_anything@yahoo.com>2014-02-17 22:58:57 -0500
commit02f89dfe9b4787fbad5f3740ed1626203c474a2b (patch)
treefa07a58cfc5f2a2835c4d6b41540a24dae7b8826
parente7ad36437caf83c4c25296542764bc4b1c819e24 (diff)
downloadtext-pipes-02f89dfe9b4787fbad5f3740ed1626203c474a2b.tar.gz
text-pipes-02f89dfe9b4787fbad5f3740ed1626203c474a2b.tar.zst
text-pipes-02f89dfe9b4787fbad5f3740ed1626203c474a2b.zip
version 0.0.0.8 fwiw
-rw-r--r--Pipes/Text.hs16
-rw-r--r--Pipes/Text/Encoding.hs2
-rw-r--r--README.md4
-rw-r--r--pipes-text.cabal2
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 @@
1{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Trustworthy #-} 1{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Trustworthy #-}
2 2
3{-| This package provides @pipes@ utilities for \'text streams\', which are 3{-| This package provides @pipes@ utilities for \'text streams\', which are
4 streams of 'Text' chunks. The individual chunks are uniformly @strict@, and you 4 streams of 'Text' chunks. The individual chunks are uniformly @strict@, and thus you
5 will generally want @Data.Text@ in scope. But the type @Producer Text m r@ is 5 will generally want @Data.Text@ in scope. But the type @Producer Text m r@ is
6 in some ways the pipes equivalent of the lazy @Text@ type. 6 in some ways the pipes equivalent of the lazy @Text@ type.
7 7
@@ -9,8 +9,8 @@
9 the 'pure' functions in 9 the 'pure' functions in
10 <https://hackage.haskell.org/package/text-1.1.0.0/docs/Data-Text-Lazy.html Data.Text.Lazy>. 10 <https://hackage.haskell.org/package/text-1.1.0.0/docs/Data-Text-Lazy.html Data.Text.Lazy>.
11 They transform, divide, group and fold text streams. Though @Producer Text m r@ 11 They transform, divide, group and fold text streams. Though @Producer Text m r@
12 is \'effectful\' Text, functions 12 is the type of \'effectful Text\', the functions in this module are \'pure\'
13 in this module are \'pure\' in the sense that they are uniformly monad-independent. 13 in the sense that they are uniformly monad-independent.
14 Simple IO operations are defined in @Pipes.Text.IO@ -- as lazy IO @Text@ 14 Simple IO operations are defined in @Pipes.Text.IO@ -- as lazy IO @Text@
15 operations are in @Data.Text.Lazy.IO@. Interoperation with @ByteString@ 15 operations are in @Data.Text.Lazy.IO@. Interoperation with @ByteString@
16 is provided in @Pipes.Text.Encoding@, which parallels @Data.Text.Lazy.Encoding@. 16 is provided in @Pipes.Text.Encoding@, which parallels @Data.Text.Lazy.Encoding@.
@@ -49,7 +49,10 @@
49 <http://hackage.haskell.org/package/pipes-parse-3.0.1/docs/Pipes-Parse-Tutorial.html pipes-parse> 49 <http://hackage.haskell.org/package/pipes-parse-3.0.1/docs/Pipes-Parse-Tutorial.html pipes-parse>
50 sense.) 50 sense.)
51 Each such expression, e.g. 'lines', 'chunksOf' or 'splitAt', reduces to the 51 Each such expression, e.g. 'lines', 'chunksOf' or 'splitAt', reduces to the
52 intuitively corresponding function when used with @view@ or @(^.)@. 52 intuitively corresponding function when used with @view@ or @(^.)@. The lens combinators
53 you will find indispensible are \'view\'/ '(^.)', 'zoom' and probably 'over', which
54 are supplied by both <http://hackage.haskell.org/package/lens lens> and
55 <http://hackage.haskell.org/package/lens-family lens-family>
53 56
54 A more important difference the example reveals is in the types closely associated with 57 A more important difference the example reveals is in the types closely associated with
55 the central type, @Producer Text m r@. In @Data.Text@ and @Data.Text.Lazy@ 58 the central type, @Producer Text m r@. In @Data.Text@ and @Data.Text.Lazy@
@@ -62,15 +65,14 @@
62 which relate a Text with a pair or list of Texts. The corresponding functions here (taking 65 which relate a Text with a pair or list of Texts. The corresponding functions here (taking
63 account of \'lensification\') are 66 account of \'lensification\') are
64 67
65> view . splitAt :: (Monad m, Integral n) 68> view . splitAt :: (Monad m, Integral n) => n -> Producer Text m r -> Producer Text.Text m (Producer Text.Text m r)
66> => n -> Producer Text m r -> Producer Text.Text m (Producer Text.Text m r)
67> view lines :: Monad m => Producer Text m r -> FreeT (Producer Text m) m r 69> view lines :: Monad m => Producer Text m r -> FreeT (Producer Text m) m r
68> view . chunksOf :: (Monad m, Integral n) => n -> Producer Text m r -> FreeT (Producer Text m) m r 70> view . chunksOf :: (Monad m, Integral n) => n -> Producer Text m r -> FreeT (Producer Text m) m r
69 71
70 In the type @Producer Text m (Producer Text m r)@ the second 72 In the type @Producer Text m (Producer Text m r)@ the second
71 element of the \'pair\' of of \'effectful Texts\' cannot simply be retrieved 73 element of the \'pair\' of of \'effectful Texts\' cannot simply be retrieved
72 with 'snd'. This is an \'effectful\' pair, and one must work through the effects 74 with 'snd'. This is an \'effectful\' pair, and one must work through the effects
73 of the first element to arrive at the second. Similarly in @FreeT (Producer Text m) m r@, 75 of the first element to arrive at the second Text stream. Similarly in @FreeT (Producer Text m) m r@,
74 which corresponds with @[Text]@, on cannot simply drop 10 Producers and take the others; 76 which corresponds with @[Text]@, on cannot simply drop 10 Producers and take the others;
75 we can only get to the ones we want to take by working through their predecessors. 77 we can only get to the ones we want to take by working through their predecessors.
76 78
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))
189> decode utf8 Byte.stdin :: Producer Text IO (Producer ByteString IO r) 189> decode utf8 Byte.stdin :: Producer Text IO (Producer ByteString IO r)
190> Bytes.stdin ^. utf8 :: Producer Text IO (Producer ByteString IO r) 190> Bytes.stdin ^. utf8 :: Producer Text IO (Producer ByteString IO r)
191 191
192 Uses of a codec with @view@ / @(^.)@ / 'decode' can always be replaced by the specialized 192 Uses of a codec with @view@ or @(^.)@ or 'decode' can always be replaced by the specialized
193 decoding functions exported here, e.g. 193 decoding functions exported here, e.g.
194 194
195> decodeUtf8 :: Producer ByteString m r -> Producer Text m (Producer ByteString m r) 195> 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
3 3
4This package follows the rule: 4This package follows the rule:
5 5
6 `pipes-text : pipes-bytestring :: text : bytestring` 6 pipes-text : pipes-bytestring :: text : bytestring
7 7
8It 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. 8The 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.
9 9
10Note 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 10Note 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 @@
1name: pipes-text 1name: pipes-text
2version: 0.0.0.8 2version: 0.0.0.8
3synopsis: Text pipes. 3synopsis: Text pipes.
4description: * 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! 4description: * 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 <https://groups.google.com/forum/#!forum/haskell-pipes pipes list>
5 . 5 .
6 This organization of the package follows the rule 6 This organization of the package follows the rule
7 . 7 .