aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Pipes/Text.hs6
-rw-r--r--Pipes/Text/Encoding.hs21
-rw-r--r--Pipes/Text/IO.hs3
-rw-r--r--pipes-text.cabal2
-rw-r--r--pipes-text.sublime-project9
5 files changed, 23 insertions, 18 deletions
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 @@
1{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Trustworthy #-} 1{-# LANGUAGE RankNTypes, TypeFamilies, BangPatterns, Safe#-}
2 2
3{-| The module @Pipes.Text@ closely follows @Pipes.ByteString@ from 3{-| The module @Pipes.Text@ closely follows @Pipes.ByteString@ from
4 the @pipes-bytestring@ package. A draft tutorial can be found in 4 the @pipes-bytestring@ package. A draft tutorial can be found in
@@ -79,9 +79,8 @@ module Pipes.Text (
79 , module Pipes.Group 79 , module Pipes.Group
80 ) where 80 ) where
81 81
82import Control.Applicative ((<*))
83import Control.Monad (liftM, join) 82import Control.Monad (liftM, join)
84import Control.Monad.Trans.State.Strict (StateT(..), modify) 83import Control.Monad.Trans.State.Strict (modify)
85import qualified Data.Text as T 84import qualified Data.Text as T
86import Data.Text (Text) 85import Data.Text (Text)
87import qualified Data.Text.Lazy as TL 86import qualified Data.Text.Lazy as TL
@@ -96,7 +95,6 @@ import qualified Pipes.Parse as PP
96import Pipes.Parse (Parser) 95import Pipes.Parse (Parser)
97import qualified Pipes.Prelude as P 96import qualified Pipes.Prelude as P
98import Data.Char (isSpace) 97import Data.Char (isSpace)
99import Data.Word (Word8)
100import Foreign.Storable (sizeOf) 98import Foreign.Storable (sizeOf)
101import Data.Bits (shiftL) 99import Data.Bits (shiftL)
102import Prelude hiding ( 100import 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
53import Data.Functor.Constant (Constant(..)) 53import Data.Functor.Constant (Constant(..))
54import Data.Char (ord) 54import Data.Char (ord)
55import Data.ByteString as B 55import Data.ByteString as B
56import Data.ByteString (ByteString)
57import Data.ByteString.Char8 as B8 56import Data.ByteString.Char8 as B8
58import Data.Text (Text) 57import Data.Text (Text)
59import qualified Data.Text as T 58import qualified Data.Text as T
@@ -61,7 +60,6 @@ import qualified Data.Text.Encoding as TE
61import qualified Data.Streaming.Text as Stream 60import qualified Data.Streaming.Text as Stream
62import Data.Streaming.Text (DecodeResult(..)) 61import Data.Streaming.Text (DecodeResult(..))
63import Control.Monad (join, liftM) 62import Control.Monad (join, liftM)
64import Data.Word (Word8)
65import Pipes 63import Pipes
66 64
67 65
@@ -93,7 +91,7 @@ import Pipes
93> for (decodeUtf16BE bytes) encodeUtf8 :: Producer ByteString IO (Producer ByteString IO ()) 91> for (decodeUtf16BE bytes) encodeUtf8 :: Producer ByteString IO (Producer ByteString IO ())
94 92
95 The bytestring producer that is returned begins with where utf16BE decoding 93 The bytestring producer that is returned begins with where utf16BE decoding
96 failed; it it didn't fail the producer is empty. 94 failed; if it didn't fail the producer is empty.
97 95
98-} 96-}
99 97
@@ -231,7 +229,7 @@ decode codec a = getConstant (codec Constant a)
231 229
232eof :: Monad m => Lens' (Producer Text m (Producer ByteString m r)) 230eof :: Monad m => Lens' (Producer Text m (Producer ByteString m r))
233 (Producer Text m (Either (Producer ByteString m r) r)) 231 (Producer Text m (Either (Producer ByteString m r) r))
234eof k p = fmap fromEither (k (toEither p)) where 232eof k p0 = fmap fromEither (k (toEither p0)) where
235 233
236 fromEither = liftM (either id return) 234 fromEither = liftM (either id return)
237 235
@@ -270,13 +268,14 @@ decodeStream :: Monad m
270decodeStream = loop where 268decodeStream = loop where
271 loop dec0 p = 269 loop dec0 p =
272 do x <- lift (next p) 270 do x <- lift (next p)
273 case x of Left r -> return (return r) 271 case x of
274 Right (chunk, p') -> case dec0 chunk of 272 Left r -> return (return r)
275 DecodeResultSuccess text dec -> do yield text 273 Right (chunk, p') -> case dec0 chunk of
276 loop dec p' 274 DecodeResultSuccess text dec -> do yield text
277 DecodeResultFailure text bs -> do yield text 275 loop dec p'
278 return (do yield bs 276 DecodeResultFailure text bs -> do yield text
279 p') 277 return (do yield bs
278 p')
280{-# INLINABLE decodeStream#-} 279{-# INLINABLE decodeStream#-}
281 280
282 281
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
28import qualified Data.Text.IO as T 28import qualified Data.Text.IO as T
29import Pipes 29import Pipes
30import qualified Pipes.Safe.Prelude as Safe 30import qualified Pipes.Safe.Prelude as Safe
31import qualified Pipes.Safe as Safe 31import Pipes.Safe (MonadSafe(..))
32import Pipes.Safe (MonadSafe(..), Base(..))
33import Prelude hiding (readFile, writeFile) 32import Prelude hiding (readFile, writeFile)
34 33
35{- $textio 34{- $textio
diff --git a/pipes-text.cabal b/pipes-text.cabal
index 673d122..0d5e42f 100644
--- a/pipes-text.cabal
+++ b/pipes-text.cabal
@@ -34,7 +34,7 @@ flag noio
34 34
35library 35library
36 exposed-modules: Pipes.Text, Pipes.Text.Encoding 36 exposed-modules: Pipes.Text, Pipes.Text.Encoding
37 build-depends: base >= 4 && < 5 , 37 build-depends: base >= 4 && < 5 ,
38 bytestring >= 0.9.2.1 && < 0.11, 38 bytestring >= 0.9.2.1 && < 0.11,
39 text >= 0.11.2 && < 1.3 , 39 text >= 0.11.2 && < 1.3 ,
40 streaming-commons >= 0.1 && < 0.2 , 40 streaming-commons >= 0.1 && < 0.2 ,
diff --git a/pipes-text.sublime-project b/pipes-text.sublime-project
new file mode 100644
index 0000000..9cbd597
--- /dev/null
+++ b/pipes-text.sublime-project
@@ -0,0 +1,9 @@
1{
2 "folders":
3 [
4 {
5 "follow_symlinks": true,
6 "path": "."
7 }
8 ]
9}