!g      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefSafe &'7;=V6seldaEA typed row identifier. Generic tables should use this instead of   . Use , to erase the type of a row identifier, and cast from the Database.Selda.UnsafeI module if you for some reason need to add a type to a row identifier. seldaWA row identifier for some table. This is the type of auto-incrementing primary keys. selda(Some value that is representable in SQL.seldaAn SQL literal.seldasAny 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. selda6Any datatype representable in (Selda's subset of) SQL.!seldaCreate a literal of this type."selda%The SQL representation for this type.#selda#Convert an SqlValue into this type.$seldaDefault value when using def at this type.%seldaRepresentation of an SQL type./seldaVFormat string used to represent date and time when talking to the database backend.0seldaMFormat string used to represent date when talking to the database backend.1seldaTFormat string used to represent time of day when talking to the database backend.gselda2The SQL type representation for the given literal.hselda8Constructor tag for all literals. Used for Ord instance.iselda4Compare two literals of different type for equality.2seldaGA row identifier which is guaranteed to not match any row in any table.3selda`Is the given row identifier invalid? I.e. is it guaranteed to not match any row in any table?4seldafCreate a row identifier from an integer. Use with caution, preferably only when reading user input.5seldaInspect a row identifier.6seldalCreate a typed row identifier from an integer. Use with caution, preferably only when reading user input.7seldaPA typed row identifier which is guaranteed to not match any row in any table.8seldafIs the given typed row identifier invalid? I.e. is it guaranteed to not match any row in any table?5j  !"$#%&'()*+,-./01gi2345678None 7;<=KSTV9:seldaFRead the next, potentially composite, result from a stream of columns.;selda4The number of nested columns contained in this type.9;:klmNone&'6;=>?FKSTK)>seldaAAn inductively defined "tuple", or heterogeneous, non-empty list.@seldaName of a database table.AseldaName of a database column.nselda6Modify the given column name using the given function.oseldaAdd a prefix to a column name.pseldaAdd a suffix to a column name.Bselda1Convert a column name into a string, with quotes.Cselda0Convert a table name into a string, with quotes.Dselda3Convert a table name into a string, without quotes.EseldaCreate a column name.FseldaCreate a column name.qselda*Escape double quotes in an SQL identifier.Gselda,Get the first element of an inductive tuple.Hselda-Get the second element of an inductive tuple.Iselda,Get the third element of an inductive tuple.Jselda-Get the fourth element of an inductive tuple.Kselda,Get the fifth element of an inductive tuple.Lselda,Get the sixth element of an inductive tuple.Mselda.Get the seventh element of an inductive tuple.Nselda-Get the eighth element of an inductive tuple.Oselda,Get the ninth element of an inductive tuple.Pselda,Get the tenth element of an inductive tuple.<r=>?@AnopBCDEFGHIJKLMNOP>1?1 None &'-;<=STSsselda(Any type which may contain column names.tselda2Get all column names used in the given expression.useldaQUnderlying column expression type, parameterised over the type of SQL queries.vseldaJA type-erased column, which may also be renamed. Only for internal use.wseldaTurn a renamed column back into a regular one. If the column was renamed, it will be represented by a literal column, and not its original expression.+stxyz{|}~uvw None"#&';=QSTVZWQselda(A parameter to a prepared SQL statement.Sselda'The order in which to sort result rows.seldaAST for SQL queries.seldaType of join to perform.seldaA source for an SQL query.selda]Build a plain SQL query with the given columns and source, with no filters, ordering, etc.selda(Create a parameter from the given value.selda$The SQL type of the given parameter.QRSUT NonehVselda Method to use for indexing with  indexedUsingk. Index methods are ignored by the SQLite backend, as SQLite doesn't support different index methods.YseldaColumn 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.selda,A complete description of a database column.`seldaA database table, based on some Haskell data type. Any single constructor type can form the basis of a table, as long as it derives Generic( and all of its fields are instances of SqlType.selda9Name of the table. NOT guaranteed to be a valid SQL name.selda%All table columns. Invariant: the = list of each column is sorted and contains no duplicates.selda;Does the given table have an auto-incrementing primary key?VXWY_]\[Z^` Nonetaselda5An 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.seldatEnsure that there are no duplicate column names or primary keys. Returns a list of validation errors encountered.seldaYReturn all columns of the given table if the table schema is valid, otherwise throw a a.selda.Sort a list and remove all duplicates from it.selda/Sort a list, then group all identical elements.a None &',;=FSTVybselda=A database row. A row is a collection of one or more columns.cseldaA database column. A column is often a literal column table, but can also be an expression over such a column or a constant expression.dseldaAny column tuple.eseldaA literal expression.5tx~}|{zyuvwbcdeNone&'6;<=>?FQSTV selda1Any table type that can have selectors generated.fselda7An inductive tuple of selectors for the given relation.gseldaBA column selector. Column selectors can be used together with the m and oH functions to get and set values on rows, or to specify foreign keys.hselda!A selector-value assignment pair.iselda(Set the given column to the given value.selda.Modify the given column by the given function.jselda%The source type of a '(!)' operation.kseldaThe result of a '(!)' operation. If either the source row, the column to extract, or both, is nullable, the result is also nullable.lselda=A selector indicating the nth (zero-based) column of a table.Will cause errors in queries during compilation, execution, or both, unless handled with extreme care. You really shouldn't use it at all.mseldaExtract the given column from the given row. Extracting a value from a nullable column will yield a nullable value. In other words, this operator is null-coalescing.nselda-Apply the given function to the given column.oseldaFor each selector-value pair in the given list, on the given tuple, update the field pointed out by the selector with the corresponding value.selda&Generate selectors for the given type. fghijklmnoi2n2NoneKI seldaSQL 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.pselda An SQL query.selda0A name, consisting of a scope and an identifier.selda.Run a query computation from an initial state.seldaJRun a query computation in isolation, but reusing the current name supply.selda.Initial state: no subqueries, no restrictions.selda,Generate a unique name for the given column.selda#Get a guaranteed unique identifier.selda$Get a guaranteed unique column name.pNoneRseldaRemove all dead columns recursively, assuming that the given list of column names contains all names present in the final result.selda^Return the names of all columns in the given top-level query. Subqueries are not traversed.selda)Return the names of all non-output (i.e. H) columns in the given top-level query. Subqueries are not traversed.seldaRGet all column names appearing in the given list of (possibly complex) columns.selda_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.seldaiBuild the outermost query from the SQL generation state. Groups are ignored, as they are only used by  aggregate.selda/Get all output columns from a list of SQL ASTs.None -1;<=FSTkqseldaOne or more aggregate columns.rseldayThe 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)tseldaNConvert 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.useldaDenotes 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.vseldanA 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.selda+Lift a function over columns to aggregates.wselda+Create a named aggregate function. Like funs, this function is generally unsafe and should ONLY be used to implement missing backend-specific functionality. qrstuvwNone&'+-6;<=>?FSTVԬseldaGeneric worker for .selda7Compute all columns needed to represent the given type.selda+Create a new value with all default fields.seldaeException indicating the use of a default value. If any values throwing this during evaluation of param xs, will be replaced by their default value.xselda: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   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.selda3Extract all insert parameters from a generic value.seldahExtract all column names from the given type. If the type is not a record, the columns will be named col_1, col_2, etc.yselda|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.xyNone&'+-6;<=>?FSTV{selda@A foreign key constraint referencing the given table and column.|selda3Some attribute that may be set on a column of type c, in a table of type t.}seldaUA generic column attribute. Essentially a pair or a record selector over the type a and a column attribute.seldaQGenerate 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 :: ID Person , name :: Text , age :: Int , pet :: Maybe Text } deriving Generic people :: Table Person people = table "people" [pId :- autoPrimary] pId :*: pName :*: pAge :*: pPet = selectors peopleThis will result in a table of Person,s, with an auto-incrementing primary key.NIf the given type does not have record selectors, the column names will be col_1, col_2, etc.seldaGenerate a table from the given table name, a list of column attributes and a function that maps from field names to column names. Ex.: data Person = Person { personId :: Int , personName :: Text , personAge :: Int , personPet :: Maybe Text } deriving Generic people :: Table Person people = tableFieldMod "people" [personName :- autoPrimaryGen] (stripPrefix "person")3This will create a table with the columns named Id, Name, Age and Pet.seldaRemove duplicate attributes.selda[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" [] q :: Query s Text q = tblBaz `from` select tblseldaGenerate 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" [] (tblBar :*: tblBaz) = selectors tbl q :: Query s Text q = do row <- select tbl return (row ! tblBaz)selda,A primary key which does not auto-increment.seldaCreate an index on this column.selda<Create an index using the given index method on this column.selda!An auto-incrementing primary key.seldaoAn untyped auto-incrementing primary key. You should really only use this for ad hoc tables, such as tuples.seldaA table-unique value.selda+An expression representing the given table.&VWXY^Z[\]_`z{|}~None selda:Backend-specific configuration for the SQL pretty-printer.selda$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.seldaHook that allows you to modify  output.selda:The SQL type name of the given type for primary keys uses.seldaParameter placeholder for the n th parameter.seldaList of column attributes.seldaHook that allows you to modify  output.seldaTThe value used for the next value for an auto-incrementing column. For instance, DEFAULT for PostgreSQL, and NULL for SQLite.selda{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.selda CREATE INDEXH suffix to indicate that the index should use the given index method.selda?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.selda"Default compilation for SQL types.selda+Default compilation for a column attribute. None,seldayCompile a sequence of queries to create the given table, including indexes. The first query in the sequence is always  CREATE TABLE.selda Compile a  CREATE INDEX query for the given index.selda!Compile a foreign key constraint.seldaCompile a table column.selda Compile a  DROP TABLE query.selda 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. None&'% seldaYSQL pretty-printer. The state is the list of SQL parameters to the prepared statement.seldaO(n log n) equivalent of  nub . sortseldaRun a pretty-printer.selda2Compile an SQL AST into a parameterized SQL query.selda#Compile a single column expression.selda Compile an UPATE statement.selda Compile a DELETE statement.seldabPretty-print a literal as a named parameter and save the name-value binding in the environment.selda&Generate a unique name for a subquery.seldaPretty-print an SQL AST.     None<Vb seldaQuery the given table.seldaQuery an ad hoc table of type aK. Each element in the given list represents one row in the ad hoc table.selda2Restrict the query somehow. Roughly equivalent to WHERE.seldaiExecute 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 :*: theAddress) <- aggregate $ do h <- select housing theAddress <- groupBy (h ! address) return (count (h ! address) :*: theAddress) restrict (num_tenants .> 1) return (num_tenants :*: theAddress)selda 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)selda Perform an  INNER JOIN1 with the current result set and the given query.seldaThe actual code for any join.selda#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: ~aggregate $ do person <- select people name' <- groupBy (person ! name) return (name' :*: count(person ! pet_name) .> 0)seldaDrop the first m rows, then get at most n2 of the remaining rows from the given subquery.seldaGSort 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: peopleInAgeAndNameOrder = do person <- select people order (person ! name) ascending order (person ! age) ascending return (person ! 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.selda%Sort the result rows in random order.selda*Remove all duplicates from the result set.seldaGPredicate determining which lines to join. | Right-hand query to join.seldaGPredicate determining which lines to join. | Right-hand query to join. None&'+;<=FSTVw seldaOAn acceptable query result type; one or more columns stitched together with :*:.seldaConverts 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.selda4Produce a list of all columns present in the result.selda3Compile 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 .selda:Compile a query using the given type translation function.seldahCompile a query into a parameterised SQL statement. Also returns all tables depended on by the query.selda 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.selda Compile an UPDATE query.selda Compile a  DELETE FROM query.seldaOCompile a query to an SQL AST. Groups are ignored, as they are only used by  aggregate.seldaZGet a fresh scope from the global scope supply, then use it to compile the given query.seldaTable to update.seldaUpdate function.selda Predicate. None&'V seldaQuery to result mapping.seldaUTable to query mapping, for keeping track of which queries depend on which tables. seldaItems currently in cache.!seldaMax number of items in cache."seldaNext cache prio to use.#selda'Reduce all parts of a cache key to HNF.$selda9Cache the given value, with the given table dependencies.%selda5Get the cached value for the given key, if it exists.&seldaPInvalidate all items in the per-process cache that depend on the given table.'selda5Set the maximum number of items allowed in the cache.($%&'NoneKϕ3selda(The simplest form of Selda computation;  specialized to ).selda0Monad transformer adding Selda SQL capabilities.selda(Some monad with Selda SQL capabilitites.)Note that the default implementations of  and  flush the entire cache and disable caching when invoked. If you want to use Selda's built-in caching mechanism, you will need to implement these operations yourself.selda-Get the connection in use by the computation.seldaInvalidate the given table as soon as the current transaction finishes. Invalidate the table immediately if no transaction is ongoing.seldaSafely 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; ORhIf an exception was raised, rollback transaction, disable bookkeeping, and re-throw the exception.*selda-Connection in use by the current computation.+seldaATables modified by the current transaction. Invariant: always Just xs% during a transaction, and always Nothing when not in a transaction.selda4A collection of functions making up a Selda backend.seldaExecute an SQL statement.seldaExecute 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.selda9Prepare a statement using the given statement identifier.seldaExecute a prepared statement.seldaGet a list of all columns in the given table, with the type and any modifiers for each column. Return an empty list if the given table does not exist.selda!SQL pretty-printer configuration.selda$Close the currently open connection.selda#Unique identifier for this backend.seldaJTurn on or off foreign key checking, and initiate/commit a transaction.>When implementing this function, it is safe to assume that disableForeignKeys True6 will always be called exactly once before each disableForeignKeys False.selda)Comprehensive information about a column.seldaName of the column.seldamSelda type of the column, or the type name given by the database if Selda couldn't make sense of the type.selda1Is the given column the primary key of its table?selda&Is the given column auto-incrementing?selda`Is the column unique, either through a UNIQUE constraint or by virtue of being a primary key?seldaCan the column be NULL?seldaDoes the column have an index?selda@Any foreign key (table, column) pairs referenced by this column.,selda+The backend used by the current connection.-seldaA 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..selda,All statements prepared for this connection./seldaIs the connection closed?0selda[Lock to prevent this connection from being used concurrently by multiple invocations of .1seldaA prepared statement.2selda2Backend-specific handle to the prepared statement.3seldaThe SQL code for the statement.4seldaAll 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.5selda$All tables touched by the statement.seldaA function which executes a query and gives back a list of extensible tuples; one tuple per result row, and one tuple element per column.6seldaAA connection identifier. Guaranteed to be unique per application.seldaIA prepared statement identifier. Guaranteed to be unique per application.seldaThrown by any function in  if an error occurs.selda&Unable to open or connect to database.selda(An error occurred while executing query.selda,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.7seldaKGenerate a fresh statement identifier, guaranteed to be unique per process.seldaVCreate a new Selda connection for the given backend and database identifier string.seldaUGet all statements and their corresponding identifiers for the current connection.selda Convert a  into a .selda>Get the column information for each column in the given table.selda*Get the backend in use by the computation.seldaHRun a Selda transformer. Backends should use this to implement their withX functions.selda)Signal transaction commit to SQL backend.selda+Signal transaction rollback to SQL backend.seldaTransaction to perform.u  !"$#%&'()*+,-./01QRY^Z[\]_&89:,-./01;23457None ;<=>?FTV seldaSome parameterized query q& that can be prepared into a function f in some  MonadSelda.<selda7Build the function that prepares and execute the query.=selda%Prepare the query and parameter list.>selda%Result type of a monadic computation.?selda-Index of first argument parameter to a query.selda)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 age@seldawReplace every indexed parameter with the corresponding provided parameter. Keep all non-indexed parameters in place.AseldapInspect a list of parameters, denoting each parameter with either a placeholder index or a literal parameter.BseldaGForce a parameter deep enough to determine whether it is a placeholder.=seldaNext argument index.selda The query.seldaThe list of param types so far.None<V@Fselda?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.seldalPerform the given query, and insert the result into the given table. Returns the number of inserted rows.seldaInsert 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 yl 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: odata Person = Person { id :: ID Person , name :: Text , age :: Int , pet :: Maybe Text } deriving Generic instance SqlResult Person people :: Table Person people = table "people" [autoPrimary :- id] main = withSQLite "my_database.sqlite" $ do insert_ people [ Person def "Link" 125 (Just "horse") , Person 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.seldakAttempt 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.seldaAttempt 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.seldaPerform 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.seldaLike I, but performs the insert when at least one row matches the predicate.seldaLike i, but does not return anything. Use this when you really don't care about how many rows were inserted.seldaLike , 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.seldaUpdate the given table using the given update function, for all rows matching the given predicate. Returns the number of updated rows.seldaLike 0, but doesn't return the number of updated rows.seldajFrom the given table, delete all rows matching the given predicate. Returns the number of deleted rows.seldaLike 1, but does not return the number of deleted rows.selda%Create a table from the given schema.selda?Create a table from the given schema, unless it already exists.seldaDrop the given table.selda#Drop the given table, if it exists.seldaPerform the given computation atomically. If an exception is raised during its execution, the entire transaction will be rolled back and the exception re-thrown, even if the exception is caught and handled within the transaction.seldaXRun the given computation as a transaction without enforcing foreign key constraints.If the computation finishes with the database in an inconsistent state with regards to foreign keys, the resulting behavior is undefined. Use with extreme caution, preferably only for migrations.?On the PostgreSQL backend, at least PostgreSQL 9.6 is required.selda$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.Cselda5Build the final result from a list of result columns.DseldaHGenerate the final result of a query from a list of untyped result rows.EseldahRun the given computation over a table after invalidating all cached results depending on that table.Fselda%Execute a statement without a result.seldaTable to update.selda Predicate.seldaUpdate function.NoneD=seldaxClose 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.p  !"$#%&'()*+,-./01@ABCDEFQRVWXY^Z[\]_p !"$# %&'()*+,-.VWXQRY^Z[\]_@AFECBD/01NoneVQseldasCast a column to another type, using whichever coercion semantics are used by the underlying SQL implementation.seldawCast an aggregate to another type, using whichever coercion semantics are used by the underlying SQL implementation.seldaA 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.seldaLike , but with two arguments.seldaLike , but with zero arguments.lwwlNone&'-6;<=FKSTV1*selda<Any container type for which we can check object membership.selda/Is the given column contained in the given set?selda=Any container type which can be mapped over. Sort of like G, if you squint a bit.selda2Extract the value of a row from a singleton table.seldadWrapper for single column tables. Use this when you need a table with only a single column, with  or .selda*Any column type that can be used with the  and  functions.seldaDAdd the given column to the column pointed to by the given selector.seldaKSubtract the given column from the column pointed to by the given selector.seldaJMultiply the column pointed to by the given selector, by the given column.selda Logically ORF the column pointed to by the given selector with the given column.selda Logically ANDF the column pointed to by the given selector with the given column.selda:Create a singleton table column from an appropriate value.seldafCreate a new column with the given fields. Any unassigned fields will contain their default values.seldaConvenient shorthand for fmap (! sel) q-. The following two queries are quivalent: Yq1 = name `from` select people q2 = do person <- select people return (person ! name)selda0Explicitly 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.seldaPCreate 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. seldaIs the given column null?seldaApplies 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 H.selda]If the second value is Nothing, return the first value. Otherwise return the second value.selda Ordering for .selda Ordering for .seldagLift a non-nullable column to a nullable one. Useful for creating expressions over optional columns: ;data Person = Person {name :: Text, age :: Int, pet :: Maybe Text} deriving Generic instance SqlRow Person people :: Table Person people = table "people" [] sName :*: sAge :*: sPet = selectors people peopleWithCats = do person <- select people restrict (person ! sPet .== just "cat") return (name ! sName)seldaSQL NULL, at any type you like.seldaSpecialization of e for integers.seldaSpecialization of e for doubles.seldaSpecialization of e for text.selda True and false boolean literals.selda True and false boolean literals.seldaThe SQL LIKE operator; matches strings with % wildcards. For instance: "%gon" `like` "dragon" .== trueselda2The number of non-null values in the given column.selda.The average of all values in the given column.seldaEThe greatest value in the given column. Texts are compared lexically.seldaEThe smallest value in the given column. Texts are compared lexically. selda#Sum all values in the given column.!selda4Round a value to the nearest integer. Equivalent to  roundTo 0."selda6Round a column to the given number of decimals places.#selda(Calculate the length of a string column.$seldaBoolean negation.%selda-Convert a boolean column to any numeric type.&selda.Convert an integer column to any numeric type.'selda!Convert any SQL type to a string.(selda!Perform a conditional on a column  !"$#23456789;:<=>?@AGHIJKLMNOPSTUVWX`abcdefghijkmnopqrstuvxyz{|}~      !"#$%&'(ax`pbcgjkmhion !"$#9;:dSTU>?786 2354    $e"# (!%&'vqtsru y@A}~|fz{VWX<=GHIJKLMNOP44222227744 4 4 4 4324NoneN DseldakA description of the difference between a column in a Selda table and its corresponding database column.RseldaYA description of the difference between a schema and its corresponding database table.IseldaAre the given types compatible?VseldacValidate a table schema, and check it for consistency against the current database. Throws a aF if the schema does not validate, or if inconsistencies were found.WseldamEnsure that the schema of the given table is valid. Does not ensure consistency with the current database.XseldaPretty-print a table diff.YseldaPretty-print a column diff.ZseldaKGet a description of the table by the given name currently in the database.[seldaCheck the given table for consistency with the current database, returning a description of all inconsistencies found. The table schema itself is not validated beforehand.\seldaCompute the difference between the two given tables. The first table is considered to be the schema, and the second the database.JseldaCompute the difference between the columns of two tables. The first table is considered to be the schema, and the second the database.%@ADEFGHIJKLMNOPQRSTUVWXYZ[\RSTUDEFGHIJKLMNOPQ@A%XYZ[\VWNone&'<ŪKseldaA migration step is zero or more migrations that need to be performed in a single transaction in order to keep the database consistent.aseldaWrapper for user with eB, enabling multiple migrations to be packed into the same list: dmigrateAll [ Migration m1_from m1_to m1_upgrade , Migration m2_from m2_to m2_upgrade , ... ]cseldaMigrate the first table into the second, using the given function to migrate all records to the new schema. Both table schemas are validated before starting the migration, and the source table is validated against what's currently in the database.sThe migration is performed as a migration, ensuring that either the entire migration passes, or none of it does.dseldaLike cA, but allows the column upgrade to access the entire database.eselda5Perform all given migrations as a single transaction.fseldaGiven a list of migration steps in ascending chronological order, finds the latest migration step starting state that matches the current database, and performs all migrations from that point until the end of the list. The whole operation is performed as a single transaction.*If no matching starting state is found, a a is thrown. If the database is already in the state specified by the end state of the final step, no migration is performed.Note that when looking for a matching starting state, index methods for indexed columns are not taken into account. Two columns c1 and c2& are considered to be identical if c1 is indexed with index method foo and c2 is indexed with index method bar.LseldaWorkhorse for migration. Is NOT performed as a transaction, so exported functions need to properly wrap calls this function.cseldaTable to migrate from.seldaTable to migrate to.seldaMapping from old to new table.eselda&Enforce foreign keys during migration?seldaMigration step to perform.fselda&Enforce foreign keys during migration?seldaMigration steps to perform.abcdefabcdefM ! "#$%&'(&)*&+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefghijklmnopqrstu v v w x y z { | } ~                 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~-                                      7                        e                           !"#$%&'()*+,-./0123456789:;<=>?@AB:CDEFGHIJKLMNOPQRSTUV$selda-0.3.2.0-9rCCRjiybAJFaa7f03grc6Database.SeldaDatabase.Selda.BackendDatabase.Selda.UnsafeDatabase.Selda.ValidationDatabase.Selda.MigrationsDatabase.Selda.SqlTypeDatabase.Selda.SqlRowDatabase.Selda.TypesDatabase.Selda.ExpDatabase.Selda.SQLDatabase.Selda.Table.TypeDatabase.Selda.Table.ValidationDatabase.Selda.ColumnDatabase.Selda.SelectorsDatabase.Selda.Query.TypeDatabase.Selda.TransformDatabase.Selda.InnerDatabase.Selda.GenericDatabase.Selda.TableDatabase.Selda.SQL.Print.ConfigDatabase.Selda.Table.CompileDatabase.Selda.SQL.PrintDatabase.Selda.QueryDatabase.Selda.CompileDatabase.Selda.CachingDatabase.Selda.Backend.InternalDatabase.Selda.PreparedDatabase.Selda.Frontendbase GHC.GenericsGenericControl.Monad.IO.ClassliftIOMonadIO text-1.2.3.0Data.Text.InternalText time-1.8.0.2&Data.Time.LocalTime.Internal.TimeOfDay TimeOfDay Data.Time.Clock.Internal.UTCTimeUTCTimeData.Time.Calendar.DaysDayIDuntypedRowIDSqlValueSqlIntSqlFloat SqlStringSqlBoolSqlBlobSqlNullLitLTextLIntLDoubleLBool LDateTimeLDateLTimeLJustLBlobLNullLCustomSqlEnumtoTextfromTextSqlTypemkLitsqlTypefromSql defaultValue SqlTypeRepTTextTRowIDTIntTFloatTBool TDateTimeTDateTTimeTBlobsqlDateTimeFormat sqlDateFormat sqlTimeFormat invalidRowIdisInvalidRowIdtoRowId fromRowIdtoId invalidId isInvalidIdSqlRow nextResult nestedColsTupHead:*: TableNameColName fromColName fromTableName rawTableName mkColName mkTableNamefirstsecondthirdfourthfifthsixthseventheighthninthtenthParamOrderAscDesc IndexMethod BTreeIndex HashIndexColAttrPrimary AutoIncrementRequiredOptionalUniqueIndexedTableValidationErrorRowColColumnsliteral SelectorsSelector Assignment:=SourceSelectedunsafeSelector!$=withQuery AggregatesLeftColsAggrCols OuterColsInnerAggraggr Relationaldef ForeignKey foreignKey AttributeAttr:-table tableFieldModtableWithSelectors selectorsprimaryindex indexUsing autoPrimaryuntypedAutoPrimaryuniquePPConfigppType ppTypeHookppTypePK ppPlaceholder ppColAttrsppColAttrsHookppAutoIncInsertppMaxInsertParamsppIndexMethodHook defPPConfigOnErrorFailIgnorecompileCreateTablecompileDropTableselect selectValuesrestrict aggregateleftJoin innerJoingroupBylimitorder orderRandomdistinctResultRescompile compileInsert compileUpdateSeldaMSeldaT MonadSeldaseldaConnectioninvalidateTablewrapTransaction SeldaBackendrunStmt runStmtWithPK prepareStmt runPrepared getTableInfoppConfigcloseConnection backendIddisableForeignKeys ColumnInfocolNamecolTypecolIsPKcolIsAutoIncrement colIsUnique colIsNullable colHasIndexcolFKsSeldaConnection QueryRunnerStmtID SeldaErrorDbErrorSqlError BackendIDSQLite PostgreSQLOther newConnectionallStmts fromColInfo columnInfo seldaBackend runSeldaTPrepare Preparablepreparedquery queryIntoinsert tryInsertupsert insertUnless insertWheninsert_ insertWithPKupdateupdate_ deleteFrom deleteFrom_ createTabletryCreateTable dropTable tryDropTable transactionwithoutForeignKeyEnforcement setLocalCache seldaClosecastcastAggrfunfun2fun0SetisInMappable Container.<$>TheTheOnlytheOnlySqlOrd+=-=*=||=&&=onlynewfrominnersuchThat.==./=.>.<.>=.<=isNull matchNullifNull.&&.|| ascending descendingjustnull_intfloattexttruefalselikecountavgmax_min_sum_round_roundTolength_not_fromBoolfromInttoString ifThenElse $fSqlOrdID $fSqlOrdMaybe$fSqlOrdTimeOfDay$fSqlOrdUTCTime $fSqlOrdDay $fSqlOrdText $fSqlOrdRowID $fSqlOrda $fSqlTypeOnly $fSqlRowOnly$fTheRow $fTheOnly $fMappableCol$fMappableAggr $fSetQuery$fSet[] $fGenericOnly $fShowOnly $fReadOnly$fEqOnly $fOrdOnly $fEnumOnly $fNumOnly$fIntegralOnly$fFractionalOnly $fRealOnly$fIsStringOnly ColumnDiff ColumnMissing ColumnPresent NameMismatch UnknownType TypeMismatchPrimaryKeyMismatchAutoIncrementMismatchNullableMismatchUniqueMismatchForeignKeyMissingForeignKeyPresent IndexMissing IndexPresent TableDiffTableOK TableMissingInconsistentColumns validateTablevalidateSchema showTableDiffshowColumnDiff describeTable diffTable diffTables$fShowColumnDiff$fShowTableDiff$fEqColumnDiff $fEqTableDiff MigrationmigratemigrateM migrateAll autoMigratelitType litConTagcompLit ResultReaderrunResultReadernext modColName addColPrefix addColSuffix escapeQuotestupHeadNames allNamesInExpSomeCol hideRenamingBinOpLikeMulSubAddOrAndNeqLteGteLtGtEqDivUnOpIsNullSgnNegAbsFunNotNulOpFun0InQueryInListAggrExCastFun2If UntypedColUntypedNamedSomeSQLJoinType SqlSourcesqlFromparam paramTypelimitsorderinggroups restrictssourcecolsLeftJoin InnerJoin EmptyTableValuesJoinProductColInfo tableName tableColscolAttrstableHasAutoPKcolExprvalidatevalidateOrThrowsnubsoupManyOnefromTuptoTupliftC3liftC2liftC GSelectorsModify selectorsFor selectorIndexGenStateName runQueryMisolate initStaterenamefreshId freshName groupColsstaticRestrictssources nameSupply nameScopeunQIdentScope renameAllremoveDeadCols allColNamesallNonOutputColNamescolNameskeepCols state2sqlallColsliftAggrunAggrsunAggrgParamsparamsgTblColsgNewDefaultValueExceptiontblColstidy tableExprdefType defColAttrcompileCreateIndex compileFKcompileTableCol compInsertPPrunPPcompSqlcompExp compUpdate compDeleteppLitfreshQueryNameppSqlPPState ppQueryNS ppParamNSppTablesppParamsdependOn ppSomeColppColsppColppNulOpppUnOpppBinOpsomeJointoRes finalCols compileWithcompileWithTables compileDelete compQuerycompQueryWithFreshScope buildResultresultsdepsitemsmaxItemsnextPrioseqCKcachecached invalidate setMaxItemsCacheKeyghc-prim GHC.TypesIO stConnectionstTouchedTables connBackendconnDbId connStmts connClosedconnLock SeldaStmt stmtHandlestmtText stmtParams stmtTablesConnID freshStmtIdSunSmkFunmkQueryResultT firstParamIx replaceParams inspectParams forceParam queryWith mkResults withInvalexecGHC.BaseFunctor Data.MaybemaybeisCompatibleWith diffColumns MigrationStepmigrateInternal