From a4913c420748559aa8bd4618bc97a562e2bd5b8f Mon Sep 17 00:00:00 2001 From: michaelt Date: Wed, 19 Feb 2014 11:15:54 -0500 Subject: generalized signatures --- Pipes/Text.hs | 4 ++-- Pipes/Text/Encoding.hs | 7 +++---- Pipes/Text/IO.hs | 4 ++-- 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)) -- | @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utilities, -- here acting as 'Text' pipes, rather as they would on a lazy text -toCaseFold :: Monad m => Pipe Text Text m () +toCaseFold :: Monad m => Pipe Text Text m r toCaseFold = P.map T.toCaseFold {-# INLINEABLE toCaseFold #-} @@ -300,7 +300,7 @@ toCaseFold = P.map T.toCaseFold -- | lowercase incoming 'Text' -toLower :: Monad m => Pipe Text Text m () +toLower :: Monad m => Pipe Text Text m r toLower = P.map T.toLower {-# INLINEABLE toLower #-} 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 -- $lenses Codec , decode - -- * Viewing the Text in a ByteString + -- * \'Viewing\' the Text in a byte stream -- $codecs , utf8 , utf8Pure @@ -57,7 +57,6 @@ import Control.Monad (join) import Data.Word (Word8) import Pipes - type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a) {- $lenses @@ -131,11 +130,11 @@ decode codec a = getConstant (codec Constant a) > zoom utf8 drawChar :: Monad m => StateT (Producer ByteString m r) m (Maybe Char) - or, with the type synonymn of @Pipes.Parse@: + or, using the type synonymn from @Pipes.Parse@: > zoom utf8 drawChar :: Monad m => Parser ByteString m (Maybe Char) - Thus we can define ByteString like this: + Thus we can define a ByteString parser like this: > withNextByte :: Parser ByteString m (Maybe Char, Maybe Word8))) > 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 * Like the functions in @Data.Text.IO@, they attempt to work with the system encoding. - * Like the functions in @Data.Text.IO@, they are slower than ByteString operations. Where + * Like the functions in @Data.Text.IO@, they significantly slower than ByteString operations. Where you know what encoding you are working with, use @Pipes.ByteString@ and @Pipes.Text.Encoding@ instead, e.g. @view utf8 Bytes.stdin@ instead of @Text.stdin@ - * Like the functions in @Data.Text.IO@ , they use Text exceptions. + * Like the functions in @Data.Text.IO@ , they use Text exceptions, not the standard Pipes protocols. Something like -- cgit v1.2.3