aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes
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
parent4ea59a8b6fb2d9ea4f7125df67ad3b91e67c6926 (diff)
downloadtext-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.tar.gz
text-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.tar.zst
text-pipes-a4913c420748559aa8bd4618bc97a562e2bd5b8f.zip
generalized signatures
Diffstat (limited to 'Pipes')
-rw-r--r--Pipes/Text.hs4
-rw-r--r--Pipes/Text/Encoding.hs7
-rw-r--r--Pipes/Text/IO.hs4
3 files changed, 7 insertions, 8 deletions
diff --git a/Pipes/Text.hs b/Pipes/Text.hs
index b90948f..575c987 100644
--- a/Pipes/Text.hs
+++ b/Pipes/Text.hs
@@ -290,7 +290,7 @@ unpack = for cat (\t -> yield (T.unpack t))
290 290
291-- | @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utilities, 291-- | @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utilities,
292-- here acting as 'Text' pipes, rather as they would on a lazy text 292-- here acting as 'Text' pipes, rather as they would on a lazy text
293toCaseFold :: Monad m => Pipe Text Text m () 293toCaseFold :: Monad m => Pipe Text Text m r
294toCaseFold = P.map T.toCaseFold 294toCaseFold = P.map T.toCaseFold
295{-# INLINEABLE toCaseFold #-} 295{-# INLINEABLE toCaseFold #-}
296 296
@@ -300,7 +300,7 @@ toCaseFold = P.map T.toCaseFold
300 300
301 301
302-- | lowercase incoming 'Text' 302-- | lowercase incoming 'Text'
303toLower :: Monad m => Pipe Text Text m () 303toLower :: Monad m => Pipe Text Text m r
304toLower = P.map T.toLower 304toLower = P.map T.toLower
305{-# INLINEABLE toLower #-} 305{-# INLINEABLE toLower #-}
306 306
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