aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormichaelt <what_is_it_to_do_anything@yahoo.com>2013-10-22 20:08:00 -0400
committermichaelt <what_is_it_to_do_anything@yahoo.com>2013-10-22 20:08:00 -0400
commit62e8521c6aff3480716ddb5d74edc7f00a1971ea (patch)
treeab679279bef564403dbb47adca7c664a4382c965
parent41f8c964077f382a28abd72d96c89dbea91b194f (diff)
downloadtext-pipes-62e8521c6aff3480716ddb5d74edc7f00a1971ea.tar.gz
text-pipes-62e8521c6aff3480716ddb5d74edc7f00a1971ea.tar.zst
text-pipes-62e8521c6aff3480716ddb5d74edc7f00a1971ea.zip
haddock repairs
-rw-r--r--Pipes/Text.hs30
-rw-r--r--Pipes/Text/Parse.hs4
2 files changed, 15 insertions, 19 deletions
diff --git a/Pipes/Text.hs b/Pipes/Text.hs
index 022855f..d811ab5 100644
--- a/Pipes/Text.hs
+++ b/Pipes/Text.hs
@@ -203,7 +203,7 @@ fromLazy :: (Monad m) => TL.Text -> Producer' Text m ()
203fromLazy = foldrChunks (\e a -> yield e >> a) (return ()) 203fromLazy = foldrChunks (\e a -> yield e >> a) (return ())
204{-# INLINABLE fromLazy #-} 204{-# INLINABLE fromLazy #-}
205 205
206-- | Stream bytes from 'stdin' 206-- | Stream text from 'stdin'
207stdin :: MonadIO m => Producer' Text m () 207stdin :: MonadIO m => Producer' Text m ()
208stdin = fromHandle IO.stdin 208stdin = fromHandle IO.stdin
209{-# INLINABLE stdin #-} 209{-# INLINABLE stdin #-}
@@ -486,7 +486,7 @@ null :: (Monad m) => Producer Text m () -> m Bool
486null = P.all T.null 486null = P.all T.null
487{-# INLINABLE null #-} 487{-# INLINABLE null #-}
488 488
489-- | Count the number of bytes 489-- | Count the number of characters in the stream
490length :: (Monad m, Num n) => Producer Text m () -> m n 490length :: (Monad m, Num n) => Producer Text m () -> m n
491length = P.fold (\n txt -> n + fromIntegral (T.length txt)) 0 id 491length = P.fold (\n txt -> n + fromIntegral (T.length txt)) 0 id
492{-# INLINABLE length #-} 492{-# INLINABLE length #-}
@@ -501,7 +501,7 @@ all :: (Monad m) => (Char -> Bool) -> Producer Text m () -> m Bool
501all predicate = P.all (T.all predicate) 501all predicate = P.all (T.all predicate)
502{-# INLINABLE all #-} 502{-# INLINABLE all #-}
503 503
504-- | Return the maximum 'Char' within a byte stream 504-- | Return the maximum 'Char' within a text stream
505maximum :: (Monad m) => Producer Text m () -> m (Maybe Char) 505maximum :: (Monad m) => Producer Text m () -> m (Maybe Char)
506maximum = P.fold step Nothing id 506maximum = P.fold step Nothing id
507 where 507 where
@@ -513,7 +513,7 @@ maximum = P.fold step Nothing id
513 Just c -> max c (T.maximum txt) 513 Just c -> max c (T.maximum txt)
514{-# INLINABLE maximum #-} 514{-# INLINABLE maximum #-}
515 515
516-- | Return the minimum 'Char' within a byte stream 516-- | Return the minimum 'Char' within a text stream (surely very useful!)
517minimum :: (Monad m) => Producer Text m () -> m (Maybe Char) 517minimum :: (Monad m) => Producer Text m () -> m (Maybe Char)
518minimum = P.fold step Nothing id 518minimum = P.fold step Nothing id
519 where 519 where
@@ -532,7 +532,7 @@ find
532find predicate p = head (p >-> filter predicate) 532find predicate p = head (p >-> filter predicate)
533{-# INLINABLE find #-} 533{-# INLINABLE find #-}
534 534
535-- | Index into a byte stream 535-- | Index into a text stream
536index 536index
537 :: (Monad m, Integral a) 537 :: (Monad m, Integral a)
538 => a-> Producer Text m () -> m (Maybe Char) 538 => a-> Producer Text m () -> m (Maybe Char)
@@ -645,8 +645,8 @@ span predicate = go
645 return (yield suffix >> p') 645 return (yield suffix >> p')
646{-# INLINABLE span #-} 646{-# INLINABLE span #-}
647 647
648{-| Split a byte stream in two, where the first byte stream is the longest 648{-| Split a text stream in two, where the first text stream is the longest
649 consecutive group of bytes that don't satisfy the predicate 649 consecutive group of characters that don't satisfy the predicate
650-} 650-}
651break 651break
652 :: (Monad m) 652 :: (Monad m)
@@ -656,7 +656,7 @@ break
656break predicate = span (not . predicate) 656break predicate = span (not . predicate)
657{-# INLINABLE break #-} 657{-# INLINABLE break #-}
658 658
659{-| Split a byte stream into sub-streams delimited by bytes that satisfy the 659{-| Split a text stream into sub-streams delimited by characters that satisfy the
660 predicate 660 predicate
661-} 661-}
662splitWith 662splitWith
@@ -693,7 +693,7 @@ split :: (Monad m)
693split c = splitWith (c ==) 693split c = splitWith (c ==)
694{-# INLINABLE split #-} 694{-# INLINABLE split #-}
695 695
696{-| Group a text stream into 'FreeT'-delimited byte streams using the supplied 696{-| Group a text stream into 'FreeT'-delimited text streams using the supplied
697 equality predicate 697 equality predicate
698-} 698-}
699groupBy 699groupBy
@@ -715,17 +715,13 @@ groupBy equal p0 = PP.FreeT (go p0)
715 return $ PP.FreeT (go p'') 715 return $ PP.FreeT (go p'')
716{-# INLINABLE groupBy #-} 716{-# INLINABLE groupBy #-}
717 717
718-- | Group a byte stream into 'FreeT'-delimited byte streams of identical bytes 718-- | Group a text stream into 'FreeT'-delimited text streams of identical characters
719group 719group
720 :: (Monad m) => Producer Text m r -> FreeT (Producer Text m) m r 720 :: (Monad m) => Producer Text m r -> FreeT (Producer Text m) m r
721group = groupBy (==) 721group = groupBy (==)
722{-# INLINABLE group #-} 722{-# INLINABLE group #-}
723 723
724{-| Split a byte stream into 'FreeT'-delimited lines 724{-| Split a text stream into 'FreeT'-delimited lines
725
726 Note: This function is purely for demonstration purposes since it assumes a
727 particular encoding. You should prefer the 'Data.Text.Text' equivalent of
728 this function from the upcoming @pipes-text@ library.
729-} 725-}
730lines 726lines
731 :: (Monad m) => Producer Text m r -> FreeT (Producer Text m) m r 727 :: (Monad m) => Producer Text m r -> FreeT (Producer Text m) m r
@@ -770,7 +766,7 @@ words p0 = removeEmpty (splitWith isSpace p0)
770 return (removeEmpty f') 766 return (removeEmpty f')
771{-# INLINABLE words #-} 767{-# INLINABLE words #-}
772 768
773-- | Intersperse a 'Char' in between the bytes of the byte stream 769-- | Intersperse a 'Char' in between the characters of the text stream
774intersperse 770intersperse
775 :: (Monad m) => Char -> Producer Text m r -> Producer Text m r 771 :: (Monad m) => Char -> Producer Text m r -> Producer Text m r
776intersperse c = go0 772intersperse c = go0
@@ -819,7 +815,7 @@ intercalate p0 = go0
819 go1 f' 815 go1 f'
820{-# INLINABLE intercalate #-} 816{-# INLINABLE intercalate #-}
821 817
822{-| Join 'FreeT'-delimited lines into a byte stream 818{-| Join 'FreeT'-delimited lines into a text stream
823-} 819-}
824unlines 820unlines
825 :: (Monad m) => FreeT (Producer Text m) m r -> Producer Text m r 821 :: (Monad m) => FreeT (Producer Text m) m r -> Producer Text m r
diff --git a/Pipes/Text/Parse.hs b/Pipes/Text/Parse.hs
index 8c3a13e..ed0afa1 100644
--- a/Pipes/Text/Parse.hs
+++ b/Pipes/Text/Parse.hs
@@ -1,4 +1,4 @@
1-- | Parsing utilities for characterstrings, in the style of @pipes-parse@ 1-- | Parsing utilities for texts, in the style of @pipes-parse@ and @Pipes.ByteString.Parse@
2 2
3module Pipes.Text.Parse ( 3module Pipes.Text.Parse (
4 -- * Parsers 4 -- * Parsers
@@ -23,7 +23,7 @@ import Prelude hiding (take, takeWhile)
23{-| Consume the first character from a 'Text' stream 23{-| Consume the first character from a 'Text' stream
24 24
25 'next' either fails with a 'Left' if the 'Producer' has no more characters or 25 'next' either fails with a 'Left' if the 'Producer' has no more characters or
26 succeeds with a 'Right' providing the next byte and the remainder of the 26 succeeds with a 'Right' providing the next character and the remainder of the
27 'Producer'. 27 'Producer'.
28-} 28-}
29nextChar 29nextChar