many -package:streamly-core

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.
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.
Many values collapsed (many or many_)