From e8336ba6e87895481d76907e7492d3cde571430c Mon Sep 17 00:00:00 2001 From: michaelt Date: Fri, 11 Sep 2015 12:48:31 -0400 Subject: detritus --- Pipes/Text.hs | 6 ++---- Pipes/Text/Encoding.hs | 21 ++++++++++----------- Pipes/Text/IO.hs | 3 +-- 3 files changed, 13 insertions(+), 17 deletions(-) (limited to 'Pipes') diff --git a/Pipes/Text.hs b/Pipes/Text.hs index e41689c..de581ad 100644 --- a/Pipes/Text.hs +++ b/Pipes/Text.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Trustworthy #-} +{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Safe#-} {-| The module @Pipes.Text@ closely follows @Pipes.ByteString@ from the @pipes-bytestring@ package. A draft tutorial can be found in @@ -79,9 +79,8 @@ module Pipes.Text ( , module Pipes.Group ) where -import Control.Applicative ((<*)) import Control.Monad (liftM, join) -import Control.Monad.Trans.State.Strict (StateT(..), modify) +import Control.Monad.Trans.State.Strict (modify) import qualified Data.Text as T import Data.Text (Text) import qualified Data.Text.Lazy as TL @@ -96,7 +95,6 @@ import qualified Pipes.Parse as PP import Pipes.Parse (Parser) import qualified Pipes.Prelude as P import Data.Char (isSpace) -import Data.Word (Word8) import Foreign.Storable (sizeOf) import Data.Bits (shiftL) import Prelude hiding ( diff --git a/Pipes/Text/Encoding.hs b/Pipes/Text/Encoding.hs index b6aa709..5a73aa9 100644 --- a/Pipes/Text/Encoding.hs +++ b/Pipes/Text/Encoding.hs @@ -53,7 +53,6 @@ module Pipes.Text.Encoding import Data.Functor.Constant (Constant(..)) import Data.Char (ord) import Data.ByteString as B -import Data.ByteString (ByteString) import Data.ByteString.Char8 as B8 import Data.Text (Text) import qualified Data.Text as T @@ -61,7 +60,6 @@ import qualified Data.Text.Encoding as TE import qualified Data.Streaming.Text as Stream import Data.Streaming.Text (DecodeResult(..)) import Control.Monad (join, liftM) -import Data.Word (Word8) import Pipes @@ -93,7 +91,7 @@ import Pipes > for (decodeUtf16BE bytes) encodeUtf8 :: Producer ByteString IO (Producer ByteString IO ()) The bytestring producer that is returned begins with where utf16BE decoding - failed; it it didn't fail the producer is empty. + failed; if it didn't fail the producer is empty. -} @@ -231,7 +229,7 @@ decode codec a = getConstant (codec Constant a) eof :: Monad m => Lens' (Producer Text m (Producer ByteString m r)) (Producer Text m (Either (Producer ByteString m r) r)) -eof k p = fmap fromEither (k (toEither p)) where +eof k p0 = fmap fromEither (k (toEither p0)) where fromEither = liftM (either id return) @@ -270,13 +268,14 @@ decodeStream :: Monad m decodeStream = loop where loop dec0 p = do x <- lift (next p) - case x of Left r -> return (return r) - Right (chunk, p') -> case dec0 chunk of - DecodeResultSuccess text dec -> do yield text - loop dec p' - DecodeResultFailure text bs -> do yield text - return (do yield bs - p') + case x of + Left r -> return (return r) + Right (chunk, p') -> case dec0 chunk of + DecodeResultSuccess text dec -> do yield text + loop dec p' + DecodeResultFailure text bs -> do yield text + return (do yield bs + p') {-# INLINABLE decodeStream#-} diff --git a/Pipes/Text/IO.hs b/Pipes/Text/IO.hs index 4a092b1..b7ef5cd 100644 --- a/Pipes/Text/IO.hs +++ b/Pipes/Text/IO.hs @@ -28,8 +28,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import Pipes import qualified Pipes.Safe.Prelude as Safe -import qualified Pipes.Safe as Safe -import Pipes.Safe (MonadSafe(..), Base(..)) +import Pipes.Safe (MonadSafe(..)) import Prelude hiding (readFile, writeFile) {- $textio -- cgit v1.2.3