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_kets_triangle :: (Scalar a, Fractional a) => [[a]] -> [[a]] -> [([a], [a])]numeric-quest Orthogonals No documentation available.
many :: forall s u (m :: Type -> Type) a . ParsecT s u m a -> ParsecT s u m [a]parsec-class Text.Parsec.Class 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) }many1 :: forall s u (m :: Type -> Type) a . ParsecT s u m a -> ParsecT s u m [a]parsec-class Text.Parsec.Class many1 p applies the parser p one or more times. Returns a list of the returned values of p.
word = many1 letter
-
parsec-class Text.Parsec.Class No documentation available.
-
parsec-class Text.Parsec.Class 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 :: forall s u (m :: Type -> Type) a . ParsecT s u m a -> ParsecT s u m ()parsec-class Text.Parsec.Class skipMany p applies the parser p zero or more times, skipping its result.
spaces = skipMany space
-
parsec-class Text.Parsec.Class skipMany1 p applies the parser p one or more times, skipping its result.
-
persistent-mysql Database.Persist.MySQL Do a bulk insert on the given records in the first parameter. In the event that a key conflicts with a record currently in the database, the second and third parameters determine what will happen. The second parameter is a list of fields to copy from the original value. This allows you to specify which fields to copy from the record you're trying to insert into the database to the preexisting row. The third parameter is a list of updates to perform that are independent of the value that is provided. You can use this to increment a counter value. These updates only occur if the original record is present in the database.
More details on HandleUpdateCollision usage
The [HandleUpdateCollision] parameter allows you to specify which fields (and under which conditions) will be copied from the inserted rows. For a brief example, consider the following data model and existing data set:Item name Text description Text price Double Maybe quantity Int Maybe Primary name
items: +------+-------------+-------+----------+ | name | description | price | quantity | +------+-------------+-------+----------+ | foo | very good | | 3 | | bar | | 3.99 | | +------+-------------+-------+----------+
This record type has a single natural key on itemName. Let's suppose that we download a CSV of new items to store into the database. Here's our CSV:name,description,price,quantity foo,,2.50,6 bar,even better,,5 yes,wow,,
We parse that into a list of Haskell records:records = [ Item { itemName = "foo", itemDescription = "" , itemPrice = Just 2.50, itemQuantity = Just 6 } , Item "bar" "even better" Nothing (Just 5) , Item "yes" "wow" Nothing Nothing ]The new CSV data is partial. It only includes updates from the upstream vendor. Our CSV library parses the missing description field as an empty string. We don't want to override the existing description. So we can use the copyUnlessEmpty function to say: "Don't update when the value is empty." Likewise, the new row for bar includes a quantity, but no price. We do not want to overwrite the existing price in the database with a NULL value. So we can use copyUnlessNull to only copy the existing values in. The final code looks like this: insertManyOnDuplicateKeyUpdate records [ copyUnlessEmpty ItemDescription , copyUnlessNull ItemPrice , copyUnlessNull ItemQuantity ] [] Once we run that code on the database, the new data set looks like this:items: +------+-------------+-------+----------+ | name | description | price | quantity | +------+-------------+-------+----------+ | foo | very good | 2.50 | 6 | | bar | even better | 3.99 | 5 | | yes | wow | | | +------+-------------+-------+----------+
AllOpAnyOperator :: AllOp -> AnyOperatorpostgresql-syntax PostgresqlSyntax.Ast No documentation available.
QualifiedAnyOperator :: ColId -> AnyOperator -> AnyOperatorpostgresql-syntax PostgresqlSyntax.Ast No documentation available.