aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormichaelt <what_is_it_to_do_anything@yahoo.com>2013-11-20 22:21:26 -0500
committermichaelt <what_is_it_to_do_anything@yahoo.com>2013-11-20 22:21:26 -0500
commitd4732515ee7ab5c5d5888fe3704e33c5b6ff16f9 (patch)
tree5d11dd826faf196e76db62f1294a97163cbab82f
parentb4d21c025864357dab2b0df07091d953c6da98f3 (diff)
downloadtext-pipes-d4732515ee7ab5c5d5888fe3704e33c5b6ff16f9.tar.gz
text-pipes-d4732515ee7ab5c5d5888fe3704e33c5b6ff16f9.tar.zst
text-pipes-d4732515ee7ab5c5d5888fe3704e33c5b6ff16f9.zip
rules for following pipes-bytestring
-rw-r--r--Pipes/Text.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Pipes/Text.hs b/Pipes/Text.hs
index f2b4aac..06f2a7f 100644
--- a/Pipes/Text.hs
+++ b/Pipes/Text.hs
@@ -305,6 +305,11 @@ toHandle :: MonadIO m => IO.Handle -> Consumer' Text m r
305toHandle h = for cat (liftIO . T.hPutStr h) 305toHandle h = for cat (liftIO . T.hPutStr h)
306{-# INLINABLE toHandle #-} 306{-# INLINABLE toHandle #-}
307 307
308{-# RULES "p >-> toHandle h" forall p h .
309 p >-> toHandle h = for p (\bs -> liftIO (T.hPutStr h bs))
310 #-}
311
312
308-- | Stream text into a file. Uses @pipes-safe@. 313-- | Stream text into a file. Uses @pipes-safe@.
309writeFile :: (MonadSafe m, Base m ~ IO) => FilePath -> Consumer' Text m () 314writeFile :: (MonadSafe m, Base m ~ IO) => FilePath -> Consumer' Text m ()
310writeFile file = Safe.withFile file IO.WriteMode toHandle 315writeFile file = Safe.withFile file IO.WriteMode toHandle
@@ -335,9 +340,10 @@ pack = P.map T.pack
335 340
336-- | Transforma a Pipes of 'Text' chunks into one of 'String's 341-- | Transforma a Pipes of 'Text' chunks into one of 'String's
337unpack :: Monad m => Pipe Text String m r 342unpack :: Monad m => Pipe Text String m r
338unpack = P.map T.unpack 343unpack = for cat (\t -> yield (T.unpack t))
339{-# INLINEABLE unpack #-} 344{-# INLINEABLE unpack #-}
340 345
346
341-- | @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utility, 347-- | @toCaseFold@, @toLower@, @toUpper@ and @stripStart@ are standard 'Text' utility,
342-- here acting on a 'Text' pipe, rather as they would on a lazy text 348-- here acting on a 'Text' pipe, rather as they would on a lazy text
343toCaseFold :: Monad m => Pipe Text Text m () 349toCaseFold :: Monad m => Pipe Text Text m ()