many

Zero or more.

Examples

>>> many (putStr "la")
lalalalalalalalala... * goes on forever *
>>> many Nothing
Just []
>>> take 5 <$> many (Just 1)
* hangs forever *
Note that this function can be used with Parsers based on Applicatives. In that case many parser will attempt to parse parser zero or more times until it fails.
Parses zero or more occurrences of the given parser.
many p applies the parser p zero or more times. Returns a list of the returned values of p.
identifier  = do{ c  <- letter
; cs <- many (alphaNum <|> char '_')
; return (c:cs)
}
Collapse multiple values in to one.
Keep parsing elements as long as the parser returns Just.
many p applies the parser p zero or more times. Returns a list of the returned values of p.
identifier  = do{ c  <- letter
; cs <- many (alphaNum <|> char '_')
; return (c:cs)
}
Zero or more.
many p applies the parser p zero or more times and returns a list of the values returned by p.
identifier = (:) <$> letter <*> many (alphaNumChar <|> char '_')
Zero or more.
many m = some m <|> pure []
Encode many displays into a single one. All will be output.
Deliver zero or more values of a.
Collect zero or more applications of a fold. many first second applies the first fold repeatedly on the input stream and accumulates it's results using the second fold.
>>> two = Fold.take 2 Fold.toList

>>> twos = Fold.many two Fold.toList

>>> Stream.fold twos $ Stream.fromList [1..10]
[[1,2],[3,4],[5,6],[7,8],[9,10]]
Stops when second fold stops. See also: concatMap, foldMany
Collect zero or more parses. Apply the supplied parser repeatedly on the input stream and push the parse results to a downstream fold. Stops: when the downstream fold stops or the parser fails. Fails: never, produces zero or more results.
>>> many = Parser.countBetween 0 maxBound
Compare with many.
Apply the first unfold to each output element of the second unfold and flatten the output in a single stream.
>>> many u = Unfold.many2 (Unfold.lmap snd u)
Parses zero or more occurrences of the given parser.
Mass-convert to nodes.
let array = element "container" $ many "wrapper" [1..3]
Which gives:
<container>
<wrapper>1</wrapper>
<wrapper>2</wrapper>
<wrapper>3</wrapper>
</container>
Use `mapM_ toXML xs` to convert a list without wrapping each item in separate element.
let mess = element "container" $ mapM_ toXML ["chunky", "chunk"]
Content nodes tend to glue together:
<container>chunkychunk</container>
Same as the usual many except a Format is no Functor, let alone Alternative.
Parse many of something. Behaves like * in regexes. This eats as much as it possibly can, if you want a minimal much rule, then use manyUntil which stops when a.