aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes/Text
diff options
context:
space:
mode:
authormichaelt <what_is_it_to_do_anything@yahoo.com>2014-02-19 11:15:54 -0500
committermichaelt <what_is_it_to_do_anything@yahoo.com>2014-02-19 11:15:54 -0500
commita4913c420748559aa8bd4618bc97a562e2bd5b8f (patch)
tree81f7306ddf6ff84dc7c7cefdfac914c12d9460c3 /Pipes/Text
parent4ea59a8b6fb2d9ea4f7125df67ad3b91e67c6926 (diff)
downloadtext-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.tar.gz
text-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.tar.zst
text-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.zip
generalized signatures
Diffstat (limited to 'Pipes/Text')
-rw-r--r--Pipes/Text/Encoding.hs7
-rw-r--r--Pipes/Text/IO.hs4
2 files changed, 5 insertions, 6 deletions
diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs
index 4311ad1..d727c2c 100644
--- a/Pipes/Text/Encoding.hs
+++ b/Pipes/Text/Encoding.hs
@@ -12,7 +12,7 @@ module Pipes.Text.Encoding
12 -- $lenses 12 -- $lenses
13 Codec 13 Codec
14 , decode 14 , decode
15 -- * Viewing the Text in a ByteString 15 -- * \'Viewing\' the Text in a byte stream
16 -- $codecs 16 -- $codecs
17 , utf8 17 , utf8
18 , utf8Pure 18 , utf8Pure
@@ -57,7 +57,6 @@ import Control.Monad (join)
57import Data.Word (Word8) 57import Data.Word (Word8)
58import Pipes 58import Pipes
59 59
60
61type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a) 60type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a)
62 61
63{- $lenses 62{- $lenses
@@ -131,11 +130,11 @@ decode codec a = getConstant (codec Constant a)
131 130
132> zoom utf8 drawChar :: Monad m => StateT (Producer ByteString m r) m (Maybe Char) 131> zoom utf8 drawChar :: Monad m => StateT (Producer ByteString m r) m (Maybe Char)
133 132
134 or, with the type synonymn of @Pipes.Parse@: 133 or, using the type synonymn from @Pipes.Parse@:
135 134
136> zoom utf8 drawChar :: Monad m => Parser ByteString m (Maybe Char) 135> zoom utf8 drawChar :: Monad m => Parser ByteString m (Maybe Char)
137 136
138 Thus we can define ByteString like this: 137 Thus we can define a ByteString parser like this:
139 138
140> withNextByte :: Parser ByteString m (Maybe Char, Maybe Word8))) 139> withNextByte :: Parser ByteString m (Maybe Char, Maybe Word8)))
141> withNextByte = do char_ <- zoom utf8 Text.drawChar 140> withNextByte = do char_ <- zoom utf8 Text.drawChar
diff --git a/Pipes/Text/IO.hs b/Pipes/Text/IO.hs
index 57c4638..23aff69 100644
--- a/Pipes/Text/IO.hs
+++ b/Pipes/Text/IO.hs
@@ -81,11 +81,11 @@ To stream from files, the following is perhaps more Prelude-like (note that it u
81 81
82 * Like the functions in @Data.Text.IO@, they attempt to work with the system encoding. 82 * Like the functions in @Data.Text.IO@, they attempt to work with the system encoding.
83 83
84 * Like the functions in @Data.Text.IO@, they are slower than ByteString operations. Where 84 * Like the functions in @Data.Text.IO@, they significantly slower than ByteString operations. Where
85 you know what encoding you are working with, use @Pipes.ByteString@ and @Pipes.Text.Encoding@ instead, 85 you know what encoding you are working with, use @Pipes.ByteString@ and @Pipes.Text.Encoding@ instead,
86 e.g. @view utf8 Bytes.stdin@ instead of @Text.stdin@ 86 e.g. @view utf8 Bytes.stdin@ instead of @Text.stdin@
87 87
88 * Like the functions in @Data.Text.IO@ , they use Text exceptions. 88 * Like the functions in @Data.Text.IO@ , they use Text exceptions, not the standard Pipes protocols.
89 89
90 Something like 90 Something like
91 91