git.iko.soy/typeable/attoparsec
on master help sign in
Merge pull request #94 from kenta2/master

Fix documentation of sepBy and friends.

commit08bbce8fd982ba408599a96caf478bec785d02e5 authorBryan O'Sullivan <bos@serpentine.com> dateTue 17 Feb 2015, 22:17 (12 years ago) parentfd97d9c6fca5f4
1 file changed+4−4
Data/Attoparsec/Combinator.hs+4−4
Data/Attoparsec/Combinator.hs+4−4
@@ -129,7 +129,7 @@ many1' p = liftM2' (:) p (many' p)
129129-- | @sepBy p sep@ applies /zero/ or more occurrences of @p@, separated
130130-- by @sep@. Returns a list of the values returned by @p@.
131131--
132−-- > commaSep p = p `sepBy` (symbol ",")
132+-- > commaSep p = p `sepBy` (char ',')
133133sepBy :: Alternative f => f a -> f s -> f [a]
134134sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure []
135135{-# SPECIALIZE sepBy :: Parser ByteString a -> Parser ByteString s
@@ -141,7 +141,7 @@ sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure []
141141-- by @sep@. Returns a list of the values returned by @p@. The value
142142-- returned by @p@ is forced to WHNF.
143143--
144−-- > commaSep p = p `sepBy'` (symbol ",")
144+-- > commaSep p = p `sepBy'` (char ',')
145145sepBy' :: (MonadPlus m) => m a -> m s -> m [a]
146146sepBy' p s = scan `mplus` return []
147147 where scan = liftM2' (:) p ((s >> sepBy1' p s) `mplus` return [])
@@ -153,7 +153,7 @@ sepBy' p s = scan `mplus` return []
153153-- | @sepBy1 p sep@ applies /one/ or more occurrences of @p@, separated
154154-- by @sep@. Returns a list of the values returned by @p@.
155155--
156−-- > commaSep p = p `sepBy1` (symbol ",")
156+-- > commaSep p = p `sepBy1` (char ',')
157157sepBy1 :: Alternative f => f a -> f s -> f [a]
158158sepBy1 p s = scan
159159 where scan = liftA2 (:) p ((s *> scan) <|> pure [])
@@ -166,7 +166,7 @@ sepBy1 p s = scan
166166-- by @sep@. Returns a list of the values returned by @p@. The value
167167-- returned by @p@ is forced to WHNF.
168168--
169−-- > commaSep p = p `sepBy1'` (symbol ",")
169+-- > commaSep p = p `sepBy1'` (char ',')
170170sepBy1' :: (MonadPlus m) => m a -> m s -> m [a]
171171sepBy1' p s = scan
172172 where scan = liftM2' (:) p ((s >> scan) `mplus` return [])