x[G      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     Safe &';=V)!WA row identifier for some table. This is the type of auto-incrementing primary keys.(Some value that is representable in SQL.An SQL literal.sAny type that's bounded, enumerable and has a text representation, and thus representable as a Selda enumerable.fWhile it would be more efficient to store enumerables as integers, this makes hand-rolled SQL touching the values inscrutable, and will break if the user a) derives Enum and b) changes the order of their constructors. Long-term, this should be implemented in PostgreSQL as a proper enum anyway, which mostly renders the performance argument moot.6Any datatype representable in (Selda's subset of) SQL.Create a literal of this type. %The SQL representation for this type.!#Convert an SqlValue into this type."Default value when using def at this type.#Representation of an SQL type.-VFormat string used to represent date and time when talking to the database backend..MFormat string used to represent date when talking to the database backend./TFormat string used to represent time of day when talking to the database backend.2The SQL type representation for the given literal.8Constructor tag for all literals. Used for Ord instance.4Compare two literals of different type for equality.0GA row identifier which is guaranteed to not match any row in any table.1`Is the given row identifier invalid? I.e. is it guaranteed to not match any row in any table?2Create a row identifier from an integer. A row identifier created using this function is not guaranteed to be a valid row identifier. Do not use unless you are absolutely sure what you're doing.3Inspect a row identifier./  "!#$%&'()*+,-./0123   !"# $%&'()*+,None&'6;=>?FKST;<TODO: replace with safe coercions when that hits platform-1.<TODO: replace with safe coercions when that hits platform-1.6fNormalized append of two inductive tuples. Note that this will flatten any nested inductive tuples.9AAn inductively defined "tuple", or heterogeneous, non-empty list.;Name of a database table.<Name of a database column.Add a prefix to a column name.Add a suffix to a column name. 1Convert a column name into a string, with quotes.!0Convert a table name into a string, with quotes."Create a column name.#Create a column name.$*Escape double quotes in an SQL identifier.=,Get the first element of an inductive tuple.>-Get the second element of an inductive tuple.?,Get the third element of an inductive tuple.@-Get the fourth element of an inductive tuple.A,Get the fifth element of an inductive tuple.B,Get the sixth element of an inductive tuple.C.Get the seventh element of an inductive tuple.D-Get the eighth element of an inductive tuple.E,Get the ninth element of an inductive tuple.F,Get the tenth element of an inductive tuple.%&'4567(89:;< !"#=>?@ABCDEF%&')*457(9:;+<,91:1None;<=>?FSTVc]G1An inductive tuple forming a table specification.H@An inductive tuple where each element is a column specification.IColumn attributes such as nullability, auto increment, etc. When adding elements, make sure that they are added in the order required by SQL syntax, as this list is only sorted before being pretty-printed.O#Any SQL type which is NOT nullable.PIs the given type nullable?QUsed by P to indicate a nullable type.RUsed by P to indicate a nullable type.SA table column specification.TA database table. Tables are parameterized over their column types. For instance, a table containing one string and one integer, in that order, would have the type Table (Text :*: Int)L, and a table containing only a single string column would have the type  Table Text.8Table and column names may contain any character except NUL=, and be non-empty. Column names must be unique per table.-9Name of the table. NOT guaranteed to be a valid SQL name..%All table columns. Invariant: the /= list of each column is sorted and contains no duplicates.0;Does the given table have an auto-incrementing primary key?U5An error occurred when validating a database table. If this error is thrown, there is a bug in your database schema, and the particular table that triggered the error is unusable. Since validation is deterministic, this error will be thrown on every consecutive operation over the offending table.bTherefore, it is not meaningful to handle this exception in any way, just fix your bug instead.V*A non-nullable column with the given name.W&A nullable column with the given name.XMarks the given column as the table's primary key. A table may only have one primary key; marking more than one key as primary will result in U during validation.Y]Automatically increment the given attribute if not specified during insert. Also adds the  PRIMARY KEY and UNIQUE attributes on the column.ZAdd a uniqueness constraint to the given column. Adding a uniqueness constraint to a column that is already implied to be unique, such as a primary key, is a no-op.19Add an attribute to a column. Not for public consumption.[(A table with the given name and columns.2Remove duplicate attributes.3.Sort a list and remove all duplicates from it.4/Sort a list, then group all identical elements.5@Ensure that there are no duplicate column names or primary keys.)G6HIMLKJNOPQRS789:;/<=T>0.-U?@VWXYZ1[2345G6IJKLMNS789:=</;T>-.0U?Nonew \:Backend-specific configuration for the SQL pretty-printer.^$The SQL type name of the given type.This function should be used everywhere a type is needed to be printed but in primary keys position. This is due to the fact that some backends might have a special representation of primary keys (using sequences are such). If you have such a need, please use the _ record instead._:The SQL type name of the given type for primary keys uses.`Parameter placeholder for the n th parameter.aList of column attributes.bTThe value used for the next value for an auto-incrementing column. For instance, DEFAULT for PostgreSQL, and NULL for SQLite.c{Insert queries may have at most this many parameters; if an insertion has more parameters than this, it will be chunked.Note that only insertions of multiple rows are chunked. If your table has more than this many columns, you should really rethink your database design.d?Default settings for pretty-printing. Geared towards SQLite.The default definition of _o is 'defType, so that you don t have to do anything special if you don t use special types for primary keys.A"Default compilation for SQL types.B+Default compilation for a column attribute. \]^_`abcd\]^_`abc None&'|eC(Any type which may contain column names.D2Get all column names used in the given expression.EQUnderlying column expression type, parameterised over the type of SQL queries.FJA type-erased column, which may also be renamed. Only for internal use.&CDGHIJKLMNOPQRSTUVWXYZ[E\]^_`abcdefFghCDG SRQPTONMLKJIHUY[XWVZE daebc`f_^]\Fhg None"#&';=QSTV e1An inductive tuple of Haskell-level values (i.e. Int :*: Maybe Text() which can be inserted into a table.ieException indicating the use of a default value. If any values throwing this during evaluation of param xs, will be replaced by their default value.f(A parameter to a prepared SQL statement.h'The order in which to sort result rows.jAST for SQL queries.kType of join to perform.lA source for an SQL query.m]Build a plain SQL query with the given columns and source, with no filters, ordering, etc.n(Create a parameter from the given value.o$The SQL type of the given parameter.epiqfghjijrstuvwxykz{l|}~mnoepiqfghijjrxwvutsyk{zl~}| NoneLn Compile a  CREATE TABLE query from a table definition.!Compile a foreign key constraint.Compile a table column.o Compile a  DROP TABLE query. Compile an  INSERT INTO query inserting m rows with n cols each. Note that backends expect insertions to NOT have a semicolon at the end. In addition to the compiled query, this function also returns the list of parameters to be passed to the backend.kmlnoklm None &',;=FSTpA database column. A column is often a literal column table, but can also be an expression over such a column or a constant expression.qAny column tuple.r<Convert a tuple of Haskell types to a tuple of column types.sA literal expression.0DGTSRQPONMLKJIHU[ZYXWVEfedcba`_^]\Fhgpqrspq None&';<=>?FQSTVt1Any table type that can have selectors generated.u5The inductive tuple of selectors for a table of type a.vBA column selector. Column selectors can be used together with the y and zU functions to get and set values on inductive tuples, or to indicate foreign keys.w!A selector-value assignment pair.y@Get the value at the given index from the given inductive tuple.zFor each selector-value pair in the given list, on the given tuple, update the field pointed out by the selector with the corresponding value.{Generate selector functions for the given table. Selectors can be used to access the fields of a query result tuple, avoiding the need to pattern match on the entire tuple. tbl :: Table (Int :*: Text) tbl = table "foo" $ required "bar" :*: required "baz" (tblBar :*: tblBaz) = selectors tbl q :: Query s Text q = tblBaz <$> select tbl|[A pair of the table with the given name and columns, and all its selectors. For example: tbl :: Table (Int :*: Text) (tbl, tblBar :*: tblBaz) = tableWithSelectors "foo" $ required "bar" :*: required "baz" q :: Query s Text q = tblBaz <$> select tbl tuvwxyz{|tvwxx2None+}Add a foreign key constraint to the given column, referencing the column indicated by the given table and selector. If the referenced column is not a primary key or has a uniqueness constraint, a U% will be thrown during validation.~Like } , but for nullable foreign keys.}~None&' YSQL pretty-printer. The state is the list of SQL parameters to the prepared statement.O(n log n) equivalent of  nub . sortRun a pretty-printer.2Compile an SQL AST into a parameterized SQL query.#Compile a single column expression. Compile an UPATE statement. Compile a DELETE statement.bPretty-print a literal as a named parameter and save the name-value binding in the environment.&Generate a unique name for a subquery.Pretty-print an SQL AST.NoneK SQL generation internal state. Contains the subqueries and static (i.e. not dependent on any subqueries) restrictions of the query currently being built, as well as a name supply for column renaming. An SQL query.0A name, consisting of a scope and an identifier..Run a query computation from an initial state.JRun a query computation in isolation, but reusing the current name supply..Initial state: no subqueries, no restrictions.,Generate a unique name for the given column.#Get a guaranteed unique identifier.$Get a guaranteed unique column name.None(Remove all dead columns recursively, assuming that the given list of column names contains all names present in the final result.^Return the names of all columns in the given top-level query. Subqueries are not traversed.)Return the names of all non-output (i.e. xH) columns in the given top-level query. Subqueries are not traversed.RGet all column names appearing in the given list of (possibly complex) columns._Remove all columns but the given, named ones and aggregates, from a query's list of outputs. If we want to refer to a column in an outer query, it must have a name. If it doesn't, then it's either not referred to by an outer query, or the outer query duplicates the expression, thereby referring directly to the names of its components.iBuild the outermost query from the SQL generation state. Groups are ignored, as they are only used by  aggregate./Get all output columns from a list of SQL ASTs.None 1;<=FSTOne or more aggregate columns.yThe results of a left join are always nullable, as there is no guarantee that all joined columns will be non-null.  JoinCols a where av is an extensible tuple is that same tuple, but in the outer query and with all elements nullable. For instance: b LeftCols (Col (Inner s) Int :*: Col (Inner s) Text) = Col s (Maybe Int) :*: Col s (Maybe Text)NConvert one or more inner column to equivalent columns in the outer query. GOuterCols (Aggr (Inner s) a :*: Aggr (Inner s) b) = Col s a :*: Col s b, for instance.Denotes an inner query. For aggregation, treating sequencing as the cartesian product of queries does not work well. Instead, we treat the sequencing of  aggregate{ with other queries as the cartesian product of the aggregated result of the query, a small but important difference.However, for this to work, the aggregate query must not depend on any columns in the outer product. Therefore, we let the aggregate query be parameterized over Inner s+ if the parent query is parameterized over s , to enforce this separation.nA single aggregate column. Aggregate columns may not be used to restrict queries. When returned from an  aggregateK subquery, an aggregate column is converted into a non-aggregate column.+Create a named aggregate function. Like funs, this function is generally unsafe and should ONLY be used to implement missing backend-specific functionality. None< IQuery the given table. Result is returned as an inductive tuple, i.e. 0first :*: second :*: third <- query tableOfThree.Query an ad hoc table of type aK. Each element in the given list represents one row in the ad hoc table.2Restrict the query somehow. Roughly equivalent to WHERE.iExecute a query, returning an aggregation of its results. The query must return an inductive tuple of  Aggregate columns. When  aggregatez returns, those columns are converted into non-aggregate columns, which may then be used to further restrict the query.Note that aggregate queries must not depend on outer queries, nor must they return any non-aggregate columns. Attempting to do either results in a type error.The SQL HAVING) keyword can be implemented by combining  aggregate and : -- Find the number of people living on every address, for all addresses -- with more than one tenant: -- SELECT COUNT(name) AS c, address FROM housing GROUP BY name HAVING c > 1 numPpl = do (num_tenants :*: address) <- aggregate $ do (_ :*: address) <- select housing groupBy address return (count address :*: some address) restrict (num_tenants .> 1) return (num_tenants :*: address) Perform a  LEFT JOIN with the current result set (i.e. the outer query) as the left hand side, and the given query as the right hand side. Like with L, the inner (or right) query must not depend on the outer (or right) one.The given predicate over the values returned by the inner query determines for each row whether to join or not. This predicate may depend on any values from the outer query.6For instance, the following will list everyone in the peopled table together with their address if they have one; if they don't, the address field will be NULL. getAddresses :: Query s (Col s Text :*: Col s (Maybe Text)) getAddresses = do (name :*: _) <- select people (_ :*: address) <- leftJoin (\(n :*: _) -> n .== name) (select addresses) return (name :*: address) Perform an  INNER JOIN1 with the current result set and the given query.The actual code for any join.#Group an aggregate query by a column. Attempting to group a non-aggregate query is a type error. An aggregate representing the grouped-by column is returned, which can be returned from the aggregate query. For instance, if you want to find out how many people have a pet at home: vaggregate $ do (name :*: pet_name) <- select people name' <- groupBy name return (name' :*: count(pet_name) > 0)Drop the first m rows, then get at most n2 of the remaining rows from the given subquery.GSort the result rows in ascending or descending order on the given row. If multiple order directives are given, later directives are given precedence but do not cancel out earlier ordering directives. To get a list of persons sorted primarily on age and secondarily on name: ypeopleInAgeAndNameOrder = do (name :*: age) <- select people order name ascending order age ascending return name For a table [Alice :*: 20, Bob :*: 20, Eve :*: 18]#, this query will always return [Eve, Alice, Bob].cThe reason for later orderings taking precedence and not the other way around is composability: orderW should always sort the current result set to avoid weird surprises when a previous order directive is buried somewhere deep in an earlier query. However, the ordering must always be stable, to ensure that previous calls to order are not simply erased.*Remove all duplicates from the result set.GPredicate determining which lines to join. | Right-hand query to join.GPredicate determining which lines to join. | Right-hand query to join. None &';<=FSTV5 OAn acceptable query result type; one or more columns stitched together with :*:.Converts the given list of SqlValue1s into an tuple of well-typed results. See  querySQLiteb for example usage. The given list must contain exactly as many elements as dictated by the Res r. If the result is  a :*: b :*: cC, then the list must contain exactly three values, for instance.4Produce a list of all columns present in the result.3Compile a query into a parameterised SQL statement.yThe types given are tailored for SQLite. To translate SQLite types into whichever types are used by your backend, use .:Compile a query using the given type translation function.hCompile a query into a parameterised SQL statement. Also returns all tables depended on by the query. Compile an INSERT query, given the keyword representing default values in the target SQL dialect, a table and a list of items corresponding to the table. Compile an UPDATE query. Compile a  DELETE FROM query.OCompile a query to an SQL AST. Groups are ignored, as they are only used by  aggregate.ZGet a fresh scope from the global scope supply, then use it to compile the given query.SQL pretty-printer config.The table to update.Update function.!Predicate: update only when true. None&'V=Z Query to result mapping.UTable to query mapping, for keeping track of which queries depend on which tables.Items currently in cache.Max number of items in cache.Next cache prio to use.'Reduce all parts of a cache key to HNF.9Cache the given value, with the given table dependencies.5Get the cached value for the given key, if it exists.PInvalidate all items in the per-process cache that depend on the given table.5Set the maximum number of items allowed in the cache.NoneKu&(The simplest form of Selda computation;  specialized to .0Monad transformer adding Selda SQL capabilities.(Some monad with Selda SQL capabilitites.-Get the connection in use by the computation.Invalidate the given table as soon as the current transaction finishes. Invalidate the table immediately if no transaction is ongoing.Safely wrap a transaction. To ensure consistency of the in-process cache, it is important that any cached tables modified during a transaction are invalidated ONLY if that transaction succeeds, AFTER the changes become visible in the database.[In order to be thread-safe in the presence of asynchronous exceptions, instances should: Mask async exceptions.?Start bookkeeping of tables invalidated during the transaction.8Perform the transaction, with async exceptions restored.BCommit transaction, invalidate tables, and disable bookkeeping; OROIf an exception was raised, rollback transaction and disable bookkeeping.See the instance for ) for an example of how to do this safely.-Connection in use by the current computation.ATables modified by the current transaction. Invariant: always Just xs% during a transaction, and always Nothing when not in a transaction.4A collection of functions making up a Selda backend.Execute an SQL statement.Execute an SQL statement and return the last inserted primary key, where the primary key is auto-incrementing. Backends must take special care to make this thread-safe.9Prepare a statement using the given statement identifier.Execute a prepared statement.!SQL pretty-printer configuration.$Close the currently open connection.#Unique identifier for this backend.+The backend used by the current connection.A string uniquely identifying the database used by this connection. This could be, for instance, a PostgreSQL connection string or the absolute path to an SQLite file.,All statements prepared for this connection.Is the connection closed?[Lock to prevent this connection from being used concurrently by multiple invocations of .A prepared statement.2Backend-specific handle to the prepared statement.The SQL code for the statement.All parameters to be passed to the prepared statement. Parameters that are unique to each invocation are specified as indices starting at 0. Backends implementing  runPrepared# should probably ignore this field.$All tables touched by the statement.A function which executes a query and gives back a list of extensible tuples; one tuple per result row, and one tuple element per column.AA connection identifier. Guaranteed to be unique per application.IA prepared statement identifier. Guaranteed to be unique per application.Thrown by any function in  if an error occurs.&Unable to open or connect to database.(An error occurred while executing query.,Uniquely identifies some particular backend.~When publishing a new backend, consider submitting a pull request with a constructor for your backend instead of using the Other constructor.KGenerate a fresh statement identifier, guaranteed to be unique per process.VCreate a new Selda connection for the given backend and database identifier string.UGet all statements and their corresponding identifiers for the current connection.*Get the backend in use by the computation.HRun a Selda transformer. Backends should use this to implement their withX functions.)Signal transaction commit to SQL backend.+Signal transaction rollback to SQL backend.Transaction to perform.c  "!#$%&'()*+,-./INJKLM\]^_`abcdfg None ;<=>?FTV Some parameterized query q& that can be prepared into a function f in some  MonadSelda.7Build the function that prepares and execute the query.%Prepare the query and parameter list.%Result type of a monadic computation.-Index of first argument parameter to a query.)Create a prepared Selda function. A prepared function has zero or more arguments, and will get compiled into a prepared statement by the first backend to execute it. Any subsequent calls to the function for the duration of the connection to the database will reuse the prepared statement.(Preparable functions are of the form E(SqlType a, SqlType b, ...) => Col s a -> Col s b -> ... -> Query s r<. The resulting prepared function will be of the form *MonadSelda m => a -> b -> ... -> m [Res r]$. Note, however, that when using prepared', you must give a concrete type for m2 due to how Haskell's type class resolution works.Prepared functions rely on memoization for just-in-time preparation and caching. This means that if GHC accidentally inlines your prepared function, it may get prepared twice. While this does not affect the correctness of your program, and is fairly unlikely to happen, if you want to be absolutely sure that your queries aren't re-prepared more than absolutely necessary, consider adding a NOINLINE& annotation to each prepared function.A usage example: ages :: Table (Text :*: Int) ages = table "ages" $ primary "name" :*: required "age" {-# NOINLINE ageOf #-} ageOf :: Text -> SeldaM [Int] ageOf = prepared $ \n -> do (name :*: age) <- select ages restrict $ name .== n return agewReplace every indexed parameter with the corresponding provided parameter. Keep all non-indexed parameters in place.pInspect a list of parameters, denoting each parameter with either a placeholder index or a literal parameter.GForce a parameter deep enough to determine whether it is a placeholder.Next argument index. The query.The list of param types so far.None<V?Run a query within a Selda monad. In practice, this is often a e transformer on top of some other monad. Selda transformers are entered using backend-specific withX functions, such as  withSQLite from the SQLite backend.Insert the given values into the given table. All columns of the table must be present. If your table has an auto-incrementing primary key, use the special value defl for that column to get the auto-incrementing behavior. Returns the number of rows that were inserted.KTo insert a list of tuples into a table with auto-incrementing primary key: \people :: Table (Int :*: Text :*: Int :*: Maybe Text) people = table "ppl" $ autoPrimary "id" :*: required "name" :*: required "age" :*: optional "pet" main = withSQLite "my_database.sqlite" $ do insert_ people [ def :*: "Link" :*: 125 :*: Just "horse" , def :*: "Zelda" :*: 119 :*: Nothing , ... ]Note that if one or more of the inserted rows would cause a constraint violation, NO rows will be inserted; the whole insertion fails atomically.kAttempt to insert a list of rows into a table, but don't raise an error if the insertion fails. Returns True* if the insertion succeeded, otherwise False.Like k, if even one of the inserted rows would cause a constraint violation, the whole insert operation fails.Attempt to perform the given update. If no rows were updated, insert the given row. Returns the primary key of the inserted row, if the insert was performed. Calling this function on a table which does not have a primary key will return Just id on a successful insert, where idE is a row identifier guaranteed to not match any row in any table.cNote that this may perform two separate queries: one update, potentially followed by one insert.Perform the given insert, if no rows already present in the table match the given predicate. Returns the primary key of the last inserted row, if the insert was performed. If called on a table which doesn't have an auto-incrementing primary key, Just id0 is always returned on successful insert, where idE is a row identifier guaranteed to not match any row in any table.Like I, but performs the insert when at least one row matches the predicate.Like i, but does not return anything. Use this when you really don't care about how many rows were inserted.Like , but returns the primary key of the last inserted row. Attempting to run this operation on a table without an auto-incrementing primary key will always return a row identifier that is guaranteed to not match any row in any table.Update the given table using the given update function, for all rows matching the given predicate. Returns the number of updated rows.Like 0, but doesn't return the number of updated rows.jFrom the given table, delete all rows matching the given predicate. Returns the number of deleted rows.Like 1, but does not return the number of deleted rows.%Create a table from the given schema.?Create a table from the given schema, unless it already exists.Drop the given table.#Drop the given table, if it exists.Perform the given computation atomically. If an exception is raised during its execution, the enture transaction will be rolled back, and the exception re-thrown.$Set the maximum local cache size to n. A cache size of zero disables local cache altogether. Changing the cache size will also flush all entries. Note that the cache is shared among all Selda computations running within the same process.(By default, local caching is turned off.WARNING: local caching is guaranteed to be consistent with the underlying database, ONLY under the assumption that no other process will modify it. Also note that the cache is shared between ALL Selda computations running within the same process.5Build the final result from a list of result columns.HGenerate the final result of a query from a list of untyped result rows.hRun the given computation over a table after invalidating all cached results depending on that table.%Execute a statement without a result.The table to update. Predicate.Update function.NoneްxClose a reusable Selda connection. Closing a connection while in use is undefined. Passing a closed connection to  results in a A being thrown. Closing a connection more than once is a no-op.T  "!#$%&'()*+,-./INJKLM\]^_`abcdfgT !" #$%&'()*+,fgIJKLMN\]^_`abcd-./NoneVisCast a column to another type, using whichever coercion semantics are used by the underlying SQL implementation.A unary operation. Note that the provided function name is spliced directly into the resulting SQL query. Thus, this function should ONLY be used to implement well-defined functions that are missing from Selda's standard library, and NOT in an ad hoc manner during queries.Like , but with two arguments.22None &';<=STV8!<Any container type for which we can check object membership./Is the given column contained in the given set?*Any column type that can be used with the  and  functions.%Validate a table schema. Throws a U| if the schema does not validate. Currently does not check the schema against what's actually in the current database.Convenient shorthand for fmap (! sel) q-. The following two queries are quivalent: Yq1 = name `from` select people q2 = do person <- select people return (person ! name)0Explicitly create an inner query. Equivalent to innerJoin (const true).Sometimes it's handy, for performance reasons and otherwise, to perform a subquery and restrict only that query before adding the result of the query to the result set, instead of first adding the query to the result set and restricting the whole result set afterwards.PCreate and filter an inner query, before adding it to the current result set.q  p% is generally more efficient than *select q >>= x -> restrict (p x) >> pure x.Is the given column null?Applies the given function to the given nullable column where it isn't null, and returns the given default value where it is. This is the Selda equivalent of . Ordering for . Ordering for .|The default value for a column during insertion. For an auto-incrementing primary key, the default value is the next key.Using def@ in any other context than insertion results in a runtime error.gLift a non-nullable column to a nullable one. Useful for creating expressions over optional columns: people :: Table (Text :*: Int :*: Maybe Text) people = table "people" $ required "name" :*: required "age" :*: optional "pet" peopleWithCats = do name :*: _ :*: pet <- select people restrict (pet .== just "cat") return nameSQL NULL, at any type you like.Specialization of s for integers.Specialization of s for doubles.Specialization of s for text. True and false boolean literals. True and false boolean literals.The SQL LIKE operator; matches strings with % wildcards. For instance: "%gon" `like` "dragon" .== true2The number of non-null values in the given column..The average of all values in the given column.EThe greatest value in the given column. Texts are compared lexically.EThe smallest value in the given column. Texts are compared lexically.#Sum all values in the given column.4Round a value to the nearest integer. Equivalent to  roundTo 0.6Round a column to the given number of decimals places.(Calculate the length of a string column.Boolean negation.-Convert a boolean column to any numeric type..Convert an integer column to any numeric type.Convert any column to a string.!Perform a conditional on a column "!013456789:;<=>?@ABCDEFGHOPQRSTUVWXYZ[ehijklmnopqrstuvwxyz{|}~UTpvywxz !"rqhij9:013seGHS;<OPRQ456ut[|{VWXY}~Zklmno78=>?@ABCDEF 477444444324None&'+;<=>?FSTVZSIConvert a value to a Haskell type from the type's corresponding relation.FConvert a value from its Haskell type into the corresponding relation.7Compute all columns needed to represent the given type.6Create a dummy value where all fields are replaced by  unsafeCoerce'd ints. See  and  for more information.-The relation corresponding to the given type.YA dummy of some type. Encapsulated to avoid improper use, since all of its fields are d ints.1Some attribute that may be set on a table column.UA generic column attribute. Essentially a pair or a record selector over the type a and a column attribute.The relation corresponding to the given Haskell type. This relation simply corresponds to the fields in the data type, from left to right. For instance: 1data Foo = Foo { bar :: Int , baz :: Text }In this example,  Relation Foo is (Int :*: Text), as the first field of Foo has type Int, and the second has type Text.,A generic table. Needs to be unpacked using gen before use with , , etc.:Any type which has a corresponding relation. To make a  Relational' instance for some type, simply derive .dNote that only types which have a single data constructor, and where all fields are instances of SqlValue can be used with this module. Attempting to use functions in this module with any type which doesn't obey those constraints will result in a very confusing type error.QGenerate a table from the given table name and list of column attributes. All MaybeT fields in the table's type will be represented by nullable columns, and all non-MaybeC fields fill be represented by required columns. For example: data Person = Person { id :: Int , name :: Text , age :: Int , pet :: Maybe Text } deriving Generic people :: GenTable Person people = genTable "people" [(name, autoPrimaryGen)]:This example will create a table with the column types #Int :*: Text :*: Int :*: Maybe Text?, where the first field is an auto-incrementing primary key.Convert a generic type into the corresponding database relation. A type's corresponding relation is simply the inductive tuple consisting of all of the type's fields. data Person = Person { id :: Int , name :: Text , age :: Int , pet :: Maybe Text } deriving Generic somePerson = Person 0 "Velvet" 19 Nothing (theId :*: theName :*: theAge :*: thePet) = toRel somePerson?This is mainly useful when inserting values into a table using ! and the other functions from Database.Selda.Convenient synonym for  map toRel.Re-assemble a generic type from its corresponding relation. This can be done either for ad hoc queries or for queries over generic tables: data SimplePerson = SimplePerson { name :: Text , age :: Int } deriving Generic demoPerson :: SimplePerson demoPerson = fromRel ("Miyu" :*: 10) adhoc :: Table (Text :*: Int) adhoc = table "adhoc" $ required "name" :*: required "age" getPersons1 :: MonadSelda m => m [SimplePerson] getPersons1 = map fromRel <$> query (select adhoc) generic :: GenTable SimplePerson generic = genTable "generic" [] getPersons2 :: MonadSelda m => m [SimplePerson] getPersons2 = map fromRel <$> query (select (gen generic)) Applying toReld to an inductive tuple which isn't the corresponding relation of the return type is a type error.Convenient synonym for  map fromRel. Like A, but accepts a generic table and its corresponding data type. Like >, but accepts a generic table and its corresponding data type. Like >, but accepts a generic table and its corresponding data type. ,A primary key which does not auto-increment. !An auto-incrementing primary key.A table-unique value.@A foreign key constraint referencing the given table and column.hExtract all column names from the given type. If the type is not a record, the columns will be named col_1, col_2, etc.!Create a dummy of the given type.FGet the selector identifier of the given selector for the given dummy.                !"#$"%&"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[\]^_`abcdefghijklmnopqrstuvwxyz{|}}~                        !"#$%&'()*+,-./01234567)89:;<=>?@ABCDEE\]FGHIJKLMNOtPQQRSTuvUVW X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v \ j  1 w x y z { | } ~    z {            \              L~   #selda-0.1.12-18rX9MrXfAkIA6mcTYjMyXDatabase.Selda.GenericDatabase.SeldaDatabase.Selda.BackendDatabase.Selda.UnsafeDatabase.Selda.SqlTypeDatabase.Selda.TypesDatabase.Selda.TableDatabase.Selda.SQL.Print.ConfigDatabase.Selda.ExpDatabase.Selda.SQLDatabase.Selda.Table.CompileDatabase.Selda.ColumnDatabase.Selda.SelectorsDatabase.Selda.Table.ForeignDatabase.Selda.SQL.PrintDatabase.Selda.Query.TypeDatabase.Selda.TransformDatabase.Selda.InnerDatabase.Selda.QueryDatabase.Selda.CompileDatabase.Selda.CachingDatabase.Selda.Backend.InternalDatabase.Selda.PreparedDatabase.Selda.Frontendbase GHC.GenericsGenericControl.Monad.IO.ClassliftIOMonadIO#text-1.2.2.2-EakMpasry3jA6OIwSZhq9MData.Text.InternalText time-1.8.0.2&Data.Time.LocalTime.Internal.TimeOfDay TimeOfDay Data.Time.Clock.Internal.UTCTimeUTCTimeData.Time.Calendar.DaysDayRowIDSqlValueSqlIntSqlFloat SqlStringSqlBoolSqlBlobSqlNullLitLTextLIntLDoubleLBool LDateTimeLDateLTimeLJustLBlobLNullLCustomSqlEnumtoTextfromTextSqlTypemkLitsqlTypefromSql defaultValue SqlTypeRepTTextTRowIDTIntTFloatTBool TDateTimeTDateTTimeTBlobsqlDateTimeFormat sqlDateFormat sqlTimeFormat invalidRowIdisInvalidRowId unsafeRowId fromRowIdAppendapp:++:TupHead:*: TableNameColNamefirstsecondthirdfourthfifthsixthseventheighthninthtenth TableSpecColSpecsColAttrPrimary AutoIncrementRequiredOptionalUniqueNonNull IsNullable NotNullableNullableColSpecTableValidationErrorrequiredoptionalprimary autoPrimaryuniquetablePPConfigppTypeppTypePK ppPlaceholder ppColAttrsppAutoIncInsertppMaxInsertParams defPPConfigInsertParamOrderAscDescOnErrorFailIgnorecompileCreateTablecompileDropTableColColumnsColsliteral HasSelectors SelectorsSelector Assignment:=!with selectorstableWithSelectorsfkoptFkQuery AggregatesLeftCols OuterColsInnerAggraggrselect selectValuesrestrict aggregateleftJoin innerJoingroupBylimitorderdistinctResultRescompile compileInsert compileUpdateSeldaMSeldaT MonadSeldaseldaConnectioninvalidateTablewrapTransaction SeldaBackendrunStmt runStmtWithPK prepareStmt runPreparedppConfigcloseConnection backendIdSeldaConnection QueryRunnerStmtID SeldaErrorDbErrorSqlError BackendIDSQLite PostgreSQLOther newConnectionallStmts seldaBackend runSeldaTPrepare Preparablepreparedqueryinsert tryInsertupsert insertUnless insertWheninsert_ insertWithPKupdateupdate_ deleteFrom deleteFrom_ createTabletryCreateTable dropTable tryDropTable transaction setLocalCache seldaClosecastfunfun2SetisInSqlOrd validateTablefrominnersuchThat.==./=.>.<.>=.<=isNull matchNull.&&.|| ascending descendingdefjustnull_intfloattexttruefalselikecountavgmax_min_sum_round_roundTolength_not_fromBoolfromInttoString ifThenElse $fSqlOrdMaybe$fSqlOrdTimeOfDay$fSqlOrdUTCTime $fSqlOrdDay $fSqlOrdText $fSqlOrda $fSetQuery$fSet[] AttributeGenAttr:-RelationGenTablegen RelationalgenTabletoReltoRelsfromRelfromRelsinsertGenWithPK insertGen insertGen_ primaryGenautoPrimaryGen uniqueGenfkGen$fGRelation:*: $fGRelationK1 $fGRelationM1$fGRelationM10$fGRelationM11 $fGFromRelM1 $fGFromRelK1 $fGFromRel:*:litType litConTagcompLit unsafeToListunsafeFromList addColPrefix addColSuffix fromColName fromTableName mkColName mkTableName escapeQuotesToDyntoDynsfromDynstupHeadUnsafe tableName tableColscolAttrstableHasAutoPKaddAttrtidysnubsoupvalidate mergeSpecsunCSColInfocolFKscolTypecolNamenewColdefType defColAttrNames allNamesInExpSomeColBinOpLikeDivMulSubAddOrAndNeqLteGteLtGtEqUnOpIsNullSgnNegAbsFunNotInQueryInListAggrExCastFun2TblColIfNamedSomeDefaultValueExceptionSQLJoinType SqlSourcesqlFromparam paramTypeparamslimitsorderinggroups restrictssourcecolsLeftJoin InnerJoin EmptyTableValuesJoinProduct compileFKcompileTableCol compInsertCunCfromTuptoTupliftC3liftC2liftCmkSelupdPPrunPPcompSqlcompExp compUpdate compDeleteppLitfreshQueryNameppSqlPPState ppQueryNS ppParamNSppTablesppParamsdependOn ppSomeColppColsppColppUnOpppBinOpGenStateName runQueryMisolate initStaterenamefreshId freshName groupColsstaticRestrictssources nameSupply nameScopeunQIdentScoperemoveDeadCols allColNamesallNonOutputColNamescolNameskeepCols state2sqlallColsunAggrsunAggrsomeJointoRes finalCols compileWithcompileWithTables compileDelete compQuerycompQueryWithFreshScoperesultsdepsitemsmaxItemsnextPrioseqCKcachecached invalidate setMaxItemsCacheKey ResultCacheghc-prim GHC.TypesIO stConnectionstTouchedTables connBackendconnDbId connStmts connClosedconnLock SeldaStmt stmtHandlestmtText stmtParams stmtTablesConnID freshStmtIdSunS SeldaStatemkFunmkQueryResultT firstParamIx replaceParams inspectParams forceParam Placeholder queryWith mkResults withInvalexec Data.MaybemaybegFromRelgToRelgTblColsgMkDummymkDummyidentifyRelDummy Unsafe.Coerce unsafeCoercetblColsGFromRel GRelation ForeignKey