>>> 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.
identifier = do{ c <- letter ; cs <- many (alphaNum <|> char '_') ; return (c:cs) }
identifier = do{ c <- letter ; cs <- many (alphaNum <|> char '_') ; return (c:cs) }
identifier = (:) <$> letter <*> many (alphaNumChar <|> char '_')
>>> 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
>>> many = Parser.countBetween 0 maxBoundCompare with many.
>>> many u = Unfold.many2 (Unfold.lmap snd u)
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>