Hoogle Search
Within LTS Haskell 24.40 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
many :: MonadPlus m => m a -> m [a]parser-combinators Control.Monad.Combinators 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 '_')
manyTill :: MonadPlus m => m a -> m end -> m [a]parser-combinators Control.Monad.Combinators manyTill p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p. Note that end result is consumed and lost. Use manyTill_ if you wish to keep it. See also: skipMany, skipManyTill.
manyTill_ :: MonadPlus m => m a -> m end -> m ([a], end)parser-combinators Control.Monad.Combinators manyTill_ p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p and the end result. Use manyTill if you have no need in the result of the end. See also: skipMany, skipManyTill.
skipMany :: MonadPlus m => m a -> m ()parser-combinators Control.Monad.Combinators skipMany p applies the parser p zero or more times, skipping its result. See also: manyTill, skipManyTill.
skipManyTill :: MonadPlus m => m a -> m end -> m endparser-combinators Control.Monad.Combinators skipManyTill p end applies the parser p zero or more times skipping results until parser end succeeds. Result parsed by end is then returned. See also: manyTill, skipMany.
many :: Alternative f => f a -> f [a]parsers Text.Parser.Combinators 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.manyTill :: Alternative m => m a -> m end -> m [a]parsers Text.Parser.Combinators manyTill p end applies parser p zero or more times until parser end succeeds. Returns the list of values returned by p. This parser can be used to scan comments:
simpleComment = do{ string "<!--" ; manyTill anyChar (try (string "-->")) }Note the overlapping parsers anyChar and string "-->", and therefore the use of the try combinator.skipMany :: Parsing m => m a -> m ()parsers Text.Parser.Combinators A version of many that discards its input. Specialized because it can often be implemented more cheaply.
executeMany :: ToRow q => Connection -> Query -> [q] -> IO Int64postgresql-simple Database.PostgreSQL.Simple Execute a multi-row INSERT, UPDATE, or other SQL query that is not expected to return results. Returns the number of rows affected. If the list of parameters is empty, this function will simply return 0 without issuing the query to the backend. If this is not desired, consider using the Values constructor instead. Throws FormatError if the query could not be formatted correctly, or a SqlError exception if the backend returns an error. For example, here's a command that inserts two rows into a table with two columns:
executeMany c [sql| INSERT INTO sometable VALUES (?,?) |] [(1, "hello"),(2, "world")]
Here's an canonical example of a multi-row update command:executeMany c [sql| UPDATE sometable SET y = upd.y FROM (VALUES (?,?)) as upd(x,y) WHERE sometable.x = upd.x |] [(1, "hello"),(2, "world")]
formatMany :: ToRow q => Connection -> Query -> [q] -> IO ByteStringpostgresql-simple Database.PostgreSQL.Simple Format a query string with a variable number of rows. This function is exposed to help with debugging and logging. Do not use it to prepare queries for execution. The query string must contain exactly one substitution group, identified by the SQL keyword "VALUES" (case insensitive) followed by an "(" character, a series of one or more "?" characters separated by commas, and a ")" character. White space in a substitution group is permitted. Throws FormatError if the query string could not be formatted correctly.