aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormichaelt <what_is_it_to_do_anything@yahoo.com>2013-10-22 18:40:23 -0400
committermichaelt <what_is_it_to_do_anything@yahoo.com>2013-10-22 18:40:23 -0400
commit7faef8bceff2440056da59920fb932b5b76f6541 (patch)
tree935ae450dad672aca4b0fda84f9993eb93ba547c
parent31f41a5d197ca9f1a613f2dc684a9fa0467a0f2e (diff)
downloadtext-pipes-7faef8bceff2440056da59920fb932b5b76f6541.tar.gz
text-pipes-7faef8bceff2440056da59920fb932b5b76f6541.tar.zst
text-pipes-7faef8bceff2440056da59920fb932b5b76f6541.zip
new module names
-rw-r--r--Pipes/Text.hs (renamed from Data/Text/Pipes.hs)49
-rw-r--r--Pipes/Text/Parse.hs (renamed from Data/Text/Pipes/Parse.hs)2
-rw-r--r--text-pipes.cabal4
3 files changed, 51 insertions, 4 deletions
diff --git a/Data/Text/Pipes.hs b/Pipes/Text.hs
index 3063aff..b0d90f0 100644
--- a/Data/Text/Pipes.hs
+++ b/Pipes/Text.hs
@@ -56,7 +56,7 @@ To stream from files, the following is perhaps more Prelude-like (note that it u
56 usage. 56 usage.
57-} 57-}
58 58
59module Data.Text.Pipes ( 59module Pipes.Text (
60 -- * Producers 60 -- * Producers
61 fromLazy, 61 fromLazy,
62 stdin, 62 stdin,
@@ -79,6 +79,10 @@ module Data.Text.Pipes (
79 dropWhile, 79 dropWhile,
80 filter, 80 filter,
81 scan, 81 scan,
82 encodeUtf8,
83 pack,
84 unpack,
85 stripStart,
82 86
83 -- * Folds 87 -- * Folds
84 toLazy, 88 toLazy,
@@ -307,6 +311,49 @@ concatMap
307concatMap f = P.map (T.concatMap f) 311concatMap f = P.map (T.concatMap f)
308{-# INLINABLE concatMap #-} 312{-# INLINABLE concatMap #-}
309 313
314
315-- | Transform a Pipe of 'Text' into a Pipe of 'ByteString's using UTF-8
316-- encoding
317encodeUtf8 :: Monad m => Pipe Text ByteString m r
318encodeUtf8 = P.map TE.encodeUtf8
319{-# INLINEABLE encodeUtf8 #-}
320
321--| Transform a Pipe of 'String's into one of 'Text' chunks
322pack :: Monad m => Pipe String Text m r
323pack = P.map T.pack
324{-# INLINEABLE pack #-}
325
326--| Transforma a Pipes of 'Text' chunks into one of 'String's
327unpack :: Monad m => Pipe Text String m r
328unpack = P.map T.unpack
329{-# INLINEABLE unpack #-}
330
331--| @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utility,
332-- here acting on a 'Text' pipe, rather as they would on a lazy text
333toCaseFold :: Monad m => Pipe Text Text m ()
334toCaseFold = P.map T.toCaseFold
335{-# INLINEABLE toCaseFold #-}
336
337--| lowercase incoming 'Text'
338toLower :: Monad m => Pipe Text Text m ()
339toLower = P.map T.toLower
340{-# INLINEABLE toLower #-}
341
342--| uppercase incoming 'Text'
343toUpper :: Monad m => Pipe Text Text m ()
344toUpper = P.map T.toUpper
345{-# INLINEABLE toUpper #-}
346
347--| Remove leading white space from an incoming succession of 'Text's
348stripStart :: Monad m => Pipe Text Text m r
349stripStart = do
350 chunk <- await
351 let text = T.stripStart chunk
352 if T.null text
353 then stripStart
354 else cat
355{-# INLINEABLE stripStart #-}
356
310-- | @(take n)@ only allows @n@ individual characters to pass; 357-- | @(take n)@ only allows @n@ individual characters to pass;
311-- contrast @Pipes.Prelude.take@ which would let @n@ chunks pass. 358-- contrast @Pipes.Prelude.take@ which would let @n@ chunks pass.
312take :: (Monad m, Integral a) => a -> Pipe Text Text m () 359take :: (Monad m, Integral a) => a -> Pipe Text Text m ()
diff --git a/Data/Text/Pipes/Parse.hs b/Pipes/Text/Parse.hs
index 675c7aa..8c3a13e 100644
--- a/Data/Text/Pipes/Parse.hs
+++ b/Pipes/Text/Parse.hs
@@ -1,6 +1,6 @@
1-- | Parsing utilities for characterstrings, in the style of @pipes-parse@ 1-- | Parsing utilities for characterstrings, in the style of @pipes-parse@
2 2
3module Data.Text.Pipes.Parse ( 3module Pipes.Text.Parse (
4 -- * Parsers 4 -- * Parsers
5 nextChar, 5 nextChar,
6 drawChar, 6 drawChar,
diff --git a/text-pipes.cabal b/text-pipes.cabal
index cc5083a..e79f168 100644
--- a/text-pipes.cabal
+++ b/text-pipes.cabal
@@ -1,4 +1,4 @@
1name: text-pipes 1name: pipes-text
2version: 0.1.0.0 2version: 0.1.0.0
3synopsis: Text pipes. 3synopsis: Text pipes.
4description: Text pipes. 4description: Text pipes.
@@ -12,7 +12,7 @@ build-type: Simple
12cabal-version: >=1.10 12cabal-version: >=1.10
13 13
14library 14library
15 exposed-modules: Data.Text.Pipes, Data.Text.Pipes.Parse 15 exposed-modules: Pipes.Text, Pipes.Text.Parse
16 -- other-modules: 16 -- other-modules:
17 other-extensions: RankNTypes 17 other-extensions: RankNTypes
18 build-depends: base >= 4 && < 5 , 18 build-depends: base >= 4 && < 5 ,