h$      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred./. Safe-Inferred/>zNone./>None  Safe-Inferred'(/?  Safe-Inferred '(/>?e None< rel8An ordering expression for a(. Primitive orderings are defined with   and  , and you can combine Order via its various instances.A common pattern is to use 1 to combine multiple orderings in sequence, and >$< (from ) to select individual columns.None  Safe-Inferred'(-. , Safe-Inferred'(-/>? rel8The Sql type class describes both null and not null database values, constrained by a specific class.For example, if you see  Sql DBEq a<, this means any database type that supports equality, and a can either be exactly an a, or it could also be Maybe a.rel8 Nullable a means that rel8 is able to check if the type a is a type that can take null values or not.rel8Homonullable a b means that both a and b can be null, or neither a or b can be null.rel8 nullify a means a cannot take null as a value.  Safe-Inferred5<rel8The schema for a table. This is used to specify the name and schema that a table belongs to (the FROM part of a SQL query), along with the schema of the columns within this table.For each selectable table in your database, you should provide a  TableSchema. in order to interact with the table via Rel8.rel8The name of the table. rel8*The schema that this table belongs to. If #, whatever is on the connection's  search_path will be used. rel8The columns of the table. Typically you would use a a higher-kinded data type here, parameterized by the  functor. None%'( rel8TypeInformation describes how to encode and decode a Haskell type to and from database queries. The typeName is the name of the type in the database, which is used to accurately type literals. rel89How to encode a single Haskell value as a SQL expression.rel83How to deserialize a single result back to Haskell.rel8The name of the SQL type.rel8Simultaneously map over how a type is both encoded and decoded, while retaining the name of the type. This operation is useful if you want to essentially newtype another .The mapping is required to be total. If you have a partial mapping, see .rel8Apply a parser to  .This can be used if the data stored in the database should only be subset of a given  . The parser is applied when deserializing rows returned - the encoder assumes that the input data is already in the appropriate form. None %&'(None>rel8Haskell types that can be represented as expressions in a database. There should be an instance of DBType6 for all column types in your database schema (e.g., int,  timestamptz, etc).Rel8 comes with stock instances for most default types in PostgreSQL, so you should only need to derive instances of this class for custom database types, such as types defined in PostgreSQL extensions, or custom domain types.rel8Corresponds to jsonbrel8Corresponds to uuidrel8Corresponds to bytearel8Corresponds to bytearel8Corresponds to citextrel8Corresponds to citextrel8Corresponds to textrel8Corresponds to textrel8Corresponds to intervalrel8Corresponds to timerel8Corresponds to  timestamprel8Corresponds to daterel8Corresponds to  timestamptzrel8Corresponds to numericrel8Corresponds to float8rel8Corresponds to float4rel8Corresponds to int8rel8Corresponds to int4rel8Corresponds to int2rel8Corresponds to charrel8Corresponds to boolNone>?rel8Database types that can be compared for equality in queries. If a type is an instance of , it means we can compare expressions for equality using the SQL = operator.None'(/? None%-/> None6None/_None/None/9>?rel8A HTable is a functor-indexed/higher-kinded data type that is representable (/), constrainable (), and specified ().This is an internal concept for Rel8, and you should not need to define instances yourself or specify this constraint. None'(+-./0>B  None%'(-/8:<>rel8 Transform a  by allowing it to be null.!None#$'(-/8:<>%"None '(/X#None %'(/mrel8The Result7 context is the context used for decoded query results.When a query is executed against a PostgreSQL database, Rel8 parses the returned rows, decoding each row into the Result context. $None />Frel8The  Labelable class is an internal implementation detail of Rel8, and indicates that we can successfully "name" all columns in a type.%None/>&None./>? 'None+/>  (None#$%'(-/8:<>? x)None/ *None/ +None%?"krel89Cast an expression to a different type. Corresponds to a CAST() function call.rel82Unsafely construct an expression from literal SQL.This is an escape hatch, and can be used if Rel8 can not adequately express the query you need. If you find yourself using this function, please let us know, as it may indicate that something is missing from Rel8! ,None%?#Lrel8%Produce an expression from a literal.Note that you can usually use -, but litExpr6 can solve problems of inference in polymorphic code..None >?%:rel8 This type class exists to allow  to have arbitrary arity. It's mostly an implementation detail, and typical uses of & shouldn't need this to be specified.rel8-Construct an n-ary function that produces an ' that when called runs a SQL function.rel8:Construct a function call for functions with no arguments.rel8Construct an expression by applying an infix binary operator to two operands./None'()/ rel8The SQL false literal. rel8The SQL true literal.!rel8The SQL AND operator."rel8The SQL OR operator.#rel8The SQL NOT operator.$rel8Fold AND" over a collection of expressions.%rel8Fold OR" over a collection of expressions.&rel8&Eliminate a boolean-valued expression.Corresponds to 01.'rel8A multi-way ifthen&else statement. The first argument to caseExpr is a list of alternatives. The first alternative that is of the form  (true, x) will be returned. If no such alternative is found, a fallback expression is returned.Corresponds to a CASE expression in SQL.(rel8 Convert a Expr (Maybe Bool) to a  Expr Bool by treating Nothing as False(. This can be useful when combined with 2, which expects a Bool, and produces expressions that optimize better than general case analysis.  !"#$%&'(!3"23None/?,)rel8!Lift an expression that can't be null to a type that might be null. This is an identity operation in terms of any generated query, and just modifies the query's type.rel8Like , but to eliminate null.*rel8Like 45 , but for null.+rel8Like 46 , but for null.,rel8Lift an operation on non-null$ values to an operation on possibly null values. When given null,  mapNull f returns null. This is like  for .-rel8Lift a binary operation on non-null; expressions to an equivalent binary operator on possibly null4 expressions. If either of the final arguments are null,  liftOpNull returns null. This is like liftA2 for ..rel8Corresponds to SQL null. )*+,-.7None&'(?1/rel8&Compare two expressions for equality. This corresponds to the SQL IS NOT DISTINCT FROM operator, and will equate null values as true. This differs from = which would return null#. This operator matches Haskell's - operator. For an operator identical to SQL =, see 1.0rel82Test if two expressions are different (not equal).This corresponds to the SQL IS DISTINCT FROM operator, and will return false when comparing two null$ values. This differs from ordinary = which would return null'. This operator is closer to Haskell's - operator. For an operator identical to SQL =, see 2.1rel8Test if two expressions are equal. This operator is usually the best choice when forming join conditions, as PostgreSQL has a much harder time optimizing a join that has multiple  conditions.This corresponds to the SQL =+ operator, though it will always return a .2rel8'Test if two expressions are different. This corresponds to the SQL <>+ operator, though it will always return a .3rel8 Like the SQL IN8 operator, but implemented by folding over a list with / and "./0123/40414248None/?2<9None24rel8Like :, but works for jsonb columns.456;None3q7rel8A deriving-via helper type for column types that store a Haskell value using a JSON encoding described by aeson's  and  type classes.789<None />?5h:rel8-The class of database types that support the / operator.;rel8-The class of database types that support the / operator.<rel8The class of database types that can be coerced to from integral expressions. This is a Rel8 concept, and allows us to provide .=rel8-The class of database types that support the +, *, - operators, and the abs, negate, sign functions.:;<==None>?6>rel8-The class of database types that support the min aggregation function.?rel8-The class of database types that support the max aggregation function.@rel8-The class of database types that support the <, <=, > and >= operators.>?@>None/>?;Arel8Types that are sum types, where each constructor is unary (that is, has no fields).Brel8DBEnum: contains the necessary metadata to describe a PostgreSQL enum type.Crel87Map Haskell values to the corresponding element of the enum type. The default implementation of this method will use the exact name of the Haskell constructors.Drel8The name of the PostgreSQL enum type that a maps to.Erel8A deriving-via helper type for column types that store an "enum" type (in Haskell terms, a sum type where all constructors are nullary) using a Postgres enum type.Note that this should map to a specific type in your database's schema (explicitly created with CREATE TYPE ... AS ENUM). Use B to specify the name of this Postgres type and the names of the individual values. If left unspecified, the names of the values of the Postgres enum are assumed to match exactly exactly the names of the constructors of the Haskell type (up to and including case sensitivity).ABCDEF?None&;Grel8A deriving-via helper type for column types that store a Haskell value using a Haskell's  and  type classes.GHI@None +/>?<Jrel8 The class of s that form a semigroup. This class is purely a Rel8 concept, and exists to mirror the  Semigroup class.Krel8An associative operation.JKK6ANone  />?=zLrel8 The class of s that form a semigroup. This class is purely a Rel8 concept, and exists to mirror the  class.LMBNone>?>Nrel8)The class of data types that support the  string_agg() aggregation function.NCNone />?>Orel8-The class of database types that support the sum() aggregation function.ODNone/:<=> ENone/8:<>FNone/8:<?GNone/8:<?GHNone./>?? INone/>?? JNone#%/9>?CnPrel8Tables are one of the foundational elements of Rel8, and describe data types that have a finite number of columns. Each of these columns contains data under a shared context, and contexts describe how to interpret the metadata about a column to a particular Haskell type. In Rel8, we have contexts for expressions (the K context), aggregations (the L context), insert values (the M contex), among others.?In typical usage of Rel8 you don't need to derive instances of P. yourself, as anything that's an instance of N is always a P.Qrel8The 1 functor that describes the schema of this table.Rrel8=The common context that all columns use as an interpretation.rel8!Any context is trivially a table.rel8Any  is also a P. PQRSTUVWONone />DXrel8Recontextualize from to a b is evidence that the types a and b are related, and that b is the same type as a;, but after changing the context from the initial context from, to the new context to.XPNone'(./2<>E rel8Typed SQL expressions.QNone%?E<RNone#%/9>?HWYrel8 Serializable; witnesses the one-to-one correspondence between the type sql/, which contains SQL expressions, and the type haskell:, which contains the Haskell decoding of rows containing sql SQL expressions.Zrel8The  FromExprs" type function maps a type in the Expr+ context to the corresponding type in the Result context.[rel8ToExprs exprs a is evidence that the types exprs and a* describe essentially the same type, but exprs is in the  context, and a is in the  context.^rel8Use lit2 to turn literal Haskell values into expressions. lit is capable of lifting single Exprs to full tables.YZ[\]^SNone#&+/9>?J_rel8 The class of Ps that can be compared for equality. Equality on tables is defined by equality of all columns all columns, so this class means "all columns in a P have an instance of ".`rel8 Compare two Ps for equality. This corresponds to comparing all columns inside each table for equality, and combining all comparisons with AND.arel8 Test if two Ps are different. This corresponds to comparing all columns inside each table for inequality, and combining all comparisons with OR._`a`4a4TNone&?Lbrel8%An if-then-else expression on tables. bool x y p returns x if p is False, and returns y if p is True.crel8Produce a table expression from a list of alternatives. Returns the first table where the  Expr Bool expression is True>. If no alternatives are true, the given default is returned.drel8Like , but to eliminate null.bcdUNone?Nerel8Like  Alternative in Haskell, some P)s form a monoid on applicative functors.frel8The identity of h.grel8Like Alt in Haskell. This class is purely a Rel8 concept, and allows you to take a choice between two tables. See also e.For example, using h on V allows you to combine two tables and to return the first one that is a "just" MaybeTable.hrel8#An associative binary operation on Ps.efghh3WNone'(./2<>?P}irel8 Selects a b means that a is a schema (i.e., a P of j s) for the  columns in b.jrel8A Name is the name of a column, as it would be defined in a table's schema definition. You can construct names by using the OverloadedStrings extension and writing string literals. This is typically done when providing a  TableSchema value.ijXNone %&?SFkrel8Construct a table in the j context containing the names of all columns. Nested column names will be combined with /. See also: l.lrel8Construct a table in the j context containing the names of all columns. The supplied function can be used to transform column names.This function can be used to generically derive the columns for a  TableSchema. For example, myTableSchema :: TableSchema (MyTable Name) myTableSchema = TableSchema { columns = namesFromLabelsWith last } will construct a  TableSchema where each columns names exactly corresponds to the name of the Haskell field.klYNone'(Tmrel8INSERT, UPDATE and DELETE all support returning either the number of rows affected, or the actual rows modified. o allows you to project out of these returned rows, which can be useful if you want to log exactly which rows were deleted, or to view a generated id (for example, if using a column with an autoincrementing counter as a default value).mnoNoneZPprel8Corresponds to  date(now()).qrel8Corresponds to calling the date function with a given time.rrel8Corresponds to x::timestamptz.srel8:Move forward a given number of days from a particular day.trel8=Find the number of days between two days. Corresponds to the - operator.urel82Subtract a given number of days from a particular . vrel8Corresponds to now().wrel8Add a time interval to a point in time, yielding a new point in time.xrel8$Find the duration between two times.yrel8Subtract a time interval from a point in time, yielding a new point in time.{rel8An interval of one second.|rel83Create a literal interval from a number of seconds.}rel8An interval of one minute.~rel83Create a literal interval from a number of minutes.rel8An interval of one hour.rel81Create a literal interval from a number of hours.rel8An interval of one day.rel80Create a literal interval from a number of days.rel8An interval of one week.rel81Create a literal interval from a number of weeks.rel8An interval of one month.rel82Create a literal interval from a number of months.rel8An interval of one year.rel81Create a literal interval from a number of years.pqrstuvwxyz{|}~pqrstuvwxyz{|}~None/db)rel8-The PostgreSQL string concatenation operator.rel8*Matches regular expression, case sensitiveCorresponds to the ~. operator.rel8,Matches regular expression, case insensitiveCorresponds to the ~* operator.rel81Does not match regular expression, case sensitiveCorresponds to the !~ operator.rel83Does not match regular expression, case insensitiveCorresponds to the !~* operator.rel8Corresponds to the  bit_length function.rel8Corresponds to the  char_length function.rel8Corresponds to the lower function.rel8Corresponds to the  octet_length function.rel8Corresponds to the upper function.rel8Corresponds to the ascii function.rel8Corresponds to the btrim function.rel8Corresponds to the chr function.rel8Corresponds to the convert function.rel8Corresponds to the  convert_from function.rel8Corresponds to the  convert_to function.rel8Corresponds to the decode function.rel8Corresponds to the encode function.rel8Corresponds to the initcap function.rel8Corresponds to the left function.rel8Corresponds to the length function.rel8Corresponds to the length function.rel8Corresponds to the lpad function.rel8Corresponds to the ltrim function.rel8Corresponds to the md5 function.rel8Corresponds to the pg_client_encoding() expression.rel8Corresponds to the  quote_ident function.rel8Corresponds to the  quote_literal function.rel8Corresponds to the quote_nullable function.rel8Corresponds to the regexp_replace function.rel8Corresponds to the regexp_split_to_array function.rel8Corresponds to the repeat function.rel8Corresponds to the replace function.rel8Corresponds to the reverse function.rel8Corresponds to the right function.rel8Corresponds to the rpad function.rel8Corresponds to the rtrim function.rel8Corresponds to the  split_part function.rel8Corresponds to the strpos function.rel8Corresponds to the substr function.rel8Corresponds to the  translate function.))62222ZNoneerel8See ?https://www.postgresql.org/docs/current/functions-sequence.html[None/grel8!Sort a column in ascending order.rel8"Sort a column in descending order.rel8Transform an ordering so that null+ values appear first. This corresponds to  NULLS FIRST in SQL.rel8Transform an ordering so that null+ values appear first. This corresponds to  NULLS LAST in SQL.\None'(/?mc rel8Corresponds to the SQL <+ operator. Note that this differs from SQL < as null3 will sort below any other value. For a version of < that exactly matches SQL, see .rel8Corresponds to the SQL <=+ operator. Note that this differs from SQL <= as null3 will sort below any other value. For a version of <= that exactly matches SQL, see .rel8Corresponds to the SQL >+ operator. Note that this differs from SQL > as null3 will sort below any other value. For a version of > that exactly matches SQL, see .rel8Corresponds to the SQL >=+ operator. Note that this differs from SQL > as null3 will sort below any other value. For a version of >= that exactly matches SQL, see .rel8Corresponds to the SQL < operator. Returns null if either arguments are null.rel8Corresponds to the SQL <= operator. Returns null if either arguments are null.rel8Corresponds to the SQL > operator. Returns null if either arguments are null.rel8Corresponds to the SQL >= operator. Returns null if either arguments are null.rel8Given two expressions, return the expression that sorts less than the other.Corresponds to the SQL least() function.rel8Given two expressions, return the expression that sorts greater than the other.Corresponds to the SQL  greatest() function. 44444444]None#&/9>?q6rel8 The class of Tables that can be ordered. Ordering on tables is defined by their lexicographic ordering of all columns, so this class means "all columns in a Table have an instance of @".rel8 Test if one Table sorts before another. Corresponds to comparing all columns with .rel8 Test if one Table sorts before, or is equal to, another. Corresponds to comparing all columns with .rel8 Test if one Table sorts after another. Corresponds to comparing all columns with .rel8 Test if one Table sorts after another. Corresponds to comparing all columns with .rel8 Given two Table0s, return the table that sorts before the other.rel8 Given two Table/s, return the table that sorts after the other.4444^None/rrel8 Construct an  for a Table by sorting all columns into ascending orders (any nullable columns will be sorted with  NULLS FIRST).rel8 Construct an  for a Table by sorting all columns into descending orders (any nullable columns will be sorted with  NULLS LAST).None?vrel8Cast < types to = types. For example, this can be useful if you need to turn an  Expr Int32 into an  Expr Double.rel8Cast = types to ;3 types. For example, his can be useful to convert  Expr Float to  Expr Double.rel8Round a ; to a <, by rounding to the nearest larger integer.Corresponds to the  ceiling() function.rel8.Perform integral division. Corresponds to the div() function.rel8Corresponds to the mod() function.rel8Round a  DFractional to a <. by rounding to the nearest smaller integer. Corresponds to the floor() function.rel8Round a ; to a <% by rounding to the nearest integer.Corresponds to the round() function.rel8Round a ; to a <2 by rounding to the nearest integer towards zero._None%'(./<=>?xrel8Aggregates a b means that the columns in a are all  s for the columns in b.rel8An  Aggregate a describes how to aggregate Table s of type a. You can unpack an  Aggregate back to a by running it with `. As  Aggregate is almost an  functor - but there is no  operation. This means  is an instance of Apply, and you can combine  Aggregate s using the  . combinator.aNone %'(/0>y bNone #%&+?z;rel8Transform a table by adding CAST to all columns. This is most useful for finalising a SELECT or RETURNING statement, guaranteed that the output matches what is encoded in each columns TypeInformation.cNone%'({rel8The constituent parts of an UPDATE statement.rel8Which table to update.rel8 How to update each selected row.rel8 Which rows to select for update.rel8What to return from the UPDATE statement.rel8Run an UPDATE statement.dNone #%'(} rel8The constituent parts of a SQL INSERT statement.rel8Which table to insert into.rel8The rows to insert.rel8What to do if the inserted rows conflict with data already in the table.rel8)What information to return on completion.rel8 OnConflict allows you to add an  ON CONFLICT clause to an INSERT statement.rel8 ON CONFLICT ABORTrel8 ON CONFLICT DO NOTHINGrel8Run an INSERT statement eNone #%'(~rel8The constituent parts of a DELETE statement.rel8Which table to delete from.rel8+Which rows should be selected for deletion.rel8What to return from the DELETE statement.rel8Run a DELETE statement.fNone?rel8Construct a query that returns the given input list of rows. This is like folding a list of  statements under g, but uses the SQL VALUES expression for efficiency.hNone?rel8Combine the results of two queries of the same type, collapsing duplicates.  union a b" is the same as the SQL statement  x UNION b.rel8Combine the results of two queries of the same type, retaining duplicates.  unionAll a b" is the same as the SQL statement  x UNION ALL b.rel8>Find the intersection of two queries, collapsing duplicates. intersect a b" is the same as the SQL statement  x INTERSECT b.rel8=Find the intersection of two queries, retaining duplicates. intersectAll a b" is the same as the SQL statement x INTERSECT ALL b.rel8:Find the difference of two queries, collapsing duplicates  except a b# is the same as the SQL statement  x INTERSECT b.rel8;Find the difference of two queries, retaining duplicates.  exceptAll a b# is the same as the SQL statement x EXCEPT ALL b.iNone<=rel8The Query monad allows you to compose a SELECT7 query. This monad has semantics similar to the list ([]) monad.rel8f =  [].rel8h = .jNonerel8#Order the rows returned by a query.kNonerel8limit n select at most n rows from a query. limit n is equivalent to the SQL LIMIT n.rel8offset n drops the first n rows from a query. offset n is equivalent to the SQL OFFSET n.lNonerel8 filter f x will be a zero-row query when f x is False, and will return x unchanged when f x is True. This is similar to mn, but as the predicate is separate from the argument, it is easy to use in a pipeline of  transformations.rel8-Drop any rows that don't match a predicate.  where_ expr is equivalent to the SQL  WHERE expr.oNonesrel8 Filter a  that might return null to a  without any nulls.Corresponds to 4p.qNone&?rel8Convert a query to a  containing the query as a SELECT statement.rNone?rel8Given a  and ,  createView runs a  CREATE VIEW statement that will save the given query as a view. This can be useful if you want to share Rel8 queries with other applications.sNoneWrel8Run a SELECT query, returning all rows.tNone%?yNone%/5<>? rel8 MaybeTable t is the table t, but as the result of an outer join. If the outer join fails to match any rows, this is essentialy Nothing7, and if the outer join does match rows, this is like Just. Unfortunately, SQL makes it impossible to distinguish whether or not an outer join matched any rows based generally on the row contents - if you were to join a row entirely of nulls, you can't distinguish if you matched an all null row, or if the match failed. For this reason  MaybeTable contains an extra field - a "nullTag" - to track whether or not the outer join produced any rows.rel8 Check if a  MaybeTable is absent of any row. Like 45.rel8 Check if a  MaybeTable contains a row. Like 46.rel8Perform case analysis on a . Like .rel8The null table. Like .rel8Lift any table into . Like . Note you can also use .rel8%Project a single expression out of a +. You can think of this operator like the 2 operator, but it also has the ability to return null.rel8 Construct a  in the j, context. This can be useful if you have a : that you are storing in a table and need to construct a  TableSchema.rel8Has the same behavior as the Monad instance for Maybe.rel8Has the same behavior as the  Applicative instance for Maybe . See also: z.rel83The name of the column to track whether a row is a  or .rel8Names of the columns in a. 4{None#$%/5<>? rel8TheseTable a b0 is a Rel8 table that contains either the table a , the table b, or both tables a and b. You can construct  TheseTable s using ,  and .  TheseTable+s can be eliminated/pattern matched using . TheseTable( is operationally the same as Haskell's & type, but adapted to work with Rel8.rel8 Test if a  was constructed with .Corresponds to |}.rel8 Test if a  was constructed with .Corresponds to |~.rel8 Test if a  was constructed with .Corresponds to |.rel8 Test if the a side of TheseTable a b is present.Corresponds to |.rel8 Test if the b table of TheseTable a b is present.Corresponds to |.rel8Attempt to project out the a table of a TheseTable a b.Corresponds to |.rel8Attempt to project out the b table of a TheseTable a b.Corresponds to |.rel8 Construct a  TheseTable. Corresponds to This.rel8 Construct a  TheseTable. Corresponds to That.rel8 Construct a  TheseTable. Corresponds to .rel8Pattern match on a . Corresponds to these.rel8 Construct a  in the j, context. This can be useful if you have a : that you are storing in a table and need to construct a  TableSchema.rel84The name of the column to track the presence of the a table.rel84The name of the column to track the presence of the b table.rel8Names of the columns in the a table.rel8Names of the columns in the b table.Nonecrel8Convert a query that might return zero rows to a query that always returns at least one row.!To speak in more concrete terms,  is most useful to write  LEFT JOINs.rel8 Filter out /s, returning only the tables that are not-null.3This operation can be used to "undo" the effect of ), which operationally is like turning a  LEFT JOIN back into a full JOIN*. You can think of this as analogous to 4p.rel8Extend an optional query with another query. This is useful if you want to step through multiple  LEFT JOINs. Note that traverseMaybeTable takes a  a -> Query b function, which means you also have the ability to "expand" one row into multiple rows. If the  a -> Query b function returns no rows, then the resulting query will also have no rows. However, regardless of the given  a -> Query b function, if the input is  nothingTable", you will always get exactly one  nothingTable back.None/;rel8+Checks if a query returns at least one row.rel8 Query b yields no rows.rel8Like without$, but with a custom membership test.None%/5<>?{rel8An EitherTable a b0 is a Rel8 table that contains either the table a or the table b. You can construct an  EitherTable using  and $, and eliminate/pattern match using .An  EitherTable( is operationally the same as Haskell's & type, but adapted to work with Rel8.rel8 Test if an  is a .rel8 Test if an  is a .rel8Pattern match/eliminate an  , by providing mappings from a  and .rel8Construct a left . Like .rel8Construct a right . Like .rel8 Construct a  in the j, context. This can be useful if you have a : that you are storing in a table and need to construct a  TableSchema.rel83The name of the column to track whether a row is a  or .rel8Names of the columns in the a table.rel8Names of the columns in the b table. None?urel8Corresponds to a FULL OUTER JOIN between two queries.rel8Filter s, keeping only  thisTables and  thoseTables.rel8Filter  s, keeping on None?rel8Filter s, keeping only  leftTables.rel8Filter s, keeping only  rightTables.rel8bitraverseEitherTable f g x will pass all  leftTable s through f and all  rightTable s through g). The results are then lifted back into  leftTable and  rightTable#, respectively. This is similar to  bitraverse for . For example,:{ select do: x <- values (map lit [ Left True, Right (42 :: Int32) ]) bitraverseEitherTable (\y -> values [y, not_ y]) (\y -> pure (y * 100)) x:} [ Left True , Left False , Right 4200]None'(/D None'(/>?None%>?rel8A  NonEmptyTable) value contains one or more instances of a. You construct  NonEmptyTables with  or  nonEmptyAgg.rel8 Construct a  NonEmptyTable& from a non-empty list of expressions.rel8 Construct a  in the j, context. This can be useful if you have a : that you are storing in a table and need to construct a  TableSchema.rel81The names of the columns of elements of the list.None%>?rel8A  ListTable* value contains zero or more instances of a. You construct  ListTables with  or .rel8 Construct a  ListTable from a list of expressions.rel8 Construct a  in the j, context. This can be useful if you have a : that you are storing in a table and need to construct a  TableSchema.rel81The names of the columns of elements of the list.None/?rel88Count the occurances of a single column. Corresponds to COUNT(a)rel8Count the number of distinct occurances of a single column. Corresponds to COUNT(DISTINCT a)rel8Corresponds to COUNT(*).rel85A count of the number of times a given expression is true.rel8Corresponds to bool_and.rel8Corresponds to bool_or.rel8Produce an aggregation for Expr a using the max function.rel8Produce an aggregation for Expr a using the max function.rel8Corresponds to sum. Note that in SQL, sum% is type changing - for example the sum of integer returns a bigint. Rel8 doesn't support this, and will add explicit cast back to the original input type. This can lead to overflows, and if you anticipate very large sums, you should upcast your input.rel89Take the sum of all expressions that satisfy a predicate.rel8Corresponds to  string_agg().rel8$Aggregate a value by grouping by it.rel8%Collect expressions values as a list.rel8/Collect expressions values as a non-empty list.None %&?rel8Group equal tables together. This works by aggregating each column in the given table with .rel8Aggregate rows into a single row containing an array of all aggregated rows. This can be used to associate multiple rows with a single row, without changing the over cardinality of the query. This allows you to essentially return a tree-like structure from queries.For example, if we have a table of orders and each orders contains multiple items, we could aggregate the table of orders, pairing each order with its items: ordersWithItems :: Query (Order Expr, ListTable (Item Expr)) ordersWithItems = do order <- each orderSchema items  -aggregate $ listAgg <$. itemsFromOrder order return (order, items) rel8Like 6, but the result is guaranteed to be a non-empty list.None?Erel8/Apply an aggregation to all rows returned by a .rel8Count the number of rows returned by a query. Note that this is different from  countStar-, as even if the given query yields no rows,  countRows will return 0.None%'(?rel8 Aggregate a  into a . If the supplied query returns 0 rows, this function will produce a , that returns one row containing the empty  ListTable. If the supplied Query does return rows, many& will return exactly one row, with a  ListTable collecting all returned rows.many is analogous to  from Control.Applicative.rel8 Aggregate a  into a . If the supplied query returns 0 rows, this function will produce a - that is empty - that is, will produce zero  NonEmptyTables. If the supplied Query does return rows, some% will return exactly one row, with a  NonEmptyTable collecting all returned rows.some is analogous to  from Control.Applicative.rel8 A version of # specialised to single expressions.rel8 A version of # specialised to single expressions.rel8 Expand a  into a :, where each row in the query is an element of the given  ListTable. catListTable is an inverse to .rel8 Expand a  into a :, where each row in the query is an element of the given  NonEmptyTable.catNonEmptyTable is an inverse to .rel81Expand an expression that contains a list into a ?, where each row in the query is an element of the given list.catList is an inverse to .rel8;Expand an expression that contains a non-empty list into a ?, where each row in the query is an element of the given list. catNonEmpty is an inverse to .None '(/?rel8Nest an  value within a Rel8able.  HThese f a b will produce a  a b in the  context, and a  a b in the  context.None /?rel8Nest a  list within a Rel8able.  HNonEmpty f a will produce a  a in the  context, and a  a in the  context.None '(/?rel8Nest a  value within a Rel8able.  HMaybe f a will produce a  a in the  context, and a  a in the  context.None /?Şrel8Nest a list within a Rel8able.  HList f a will produce a  a in the  context, and a [a] in the  context.None /?Ɣrel8Nest an  value within a Rel8able.  HEither f a b will produce a  a b in the  context, and a  a b in the  context.None /?ǿrel8/This type family is used to specify columns in Rel8ables. In  Column f a, f is the context of the column (which should be left polymorphic in Rel8able definitions), and a is the type of the column.None/9>?rel8,This type class allows you to define custom Tables using higher-kinded data types. Higher-kinded data types are data types of the pattern: data MyType f = MyType { field1 :: Column f T1 OR HK1 f , field2 :: Column f T2 OR HK2 f , ... , fieldN :: Column f Tn OR HKn f } where Tn is any Haskell type, and HKn is any higher-kinded type.That is, higher-kinded data are records where all fields in the record are all either of the type  Column f T (for any T)), or are themselves higher-kinded data: Nested data Nested f = Nested { nested1 :: MyType f , nested2 :: MyType f } The Rel8able type class is used to give us a special mapping operation that lets us change the type parameter f.  Supplying Rel8able instancesThis type class should be derived generically for all table types in your project. To do this, enable the  DeriveAnyType and  DeriveGeneric language extensions: {-# LANGUAGE DeriveAnyClass, DeriveGeneric #-} data MyType f = MyType { fieldA :: Column f T } deriving ( GHC.Generics.Generic, Rel8able ) rel8 The kind of  types None+/>%None%&-/>?ͅ None/>?None/>?;None/>ΖNone%&'(+/?ҿrel8 is used to associate composite type metadata with a Haskell type.rel83The names of all fields in the composite type that a maps to.rel8$The name of the composite type that a maps to.rel8A deriving-via helper type for column types that store a Haskell product type in a single Postgres column using a Postgres composite type.Note that this must map to a specific extant type in your database's schema (created with  CREATE TYPE). Use  to specify the name of this Postgres type and the names of the individual fields (for projecting with ).rel8 Collapse a " into a PostgreSQL composite type. values are represented in queries by having a column for each field in the corresponding Haskell type.  collapses these columns into a single column expression, by combining them into a PostgreSQL composite type.rel8Expand a composite type into a . is the inverse of .None /None /2None#Y  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPRQSVUTWXYZ[\]^_`abcdefghijklmno789456GHIEFBCDA JKLM=<;:PRQSVUTWXghef_`a^bc jkl.)d*+,-( #!$"%/0123&'@i?>ONY[\]ZmnoNone#/28:<=>|7PK i#$++,....//////////33333377777999;:;:;<<<<===>>>>>>???@@AABCJJJJJJJJORRRRRR-SSST1TTUUUUWWXXYYYZu[ [ [[\\\\\\\\\\]^^__LcccccccdMdMddddddddeeeeeefhghhhhhjkkll2oqrstttvwwwyVyyyyyyy{{{{{{{{{{{{{z`N                 N      !!!!"""""########$$$$$%%%%%%%&&&&&&&&&'''''''''''((((()*++++++++++,,34333338888888DDDDDDDDDEEEEEEFFFFGGGGGHHHHHHHHHHIIIIIIIIIIJJJJJJJPKPPQRRSWWWXXX]]]]]]]________L___aaaaaaaaabbbbbbbbiiiqqsxxxxxxxxxxxxxxyyyVyy{{{#rel8-1.0.0.1-GgB5LDq09tADOjyAH2c9jTRel8Rel8.Expr.TimeRel8.Expr.Text Rel8.Expr.NumRel8.FCFRel8.Generic.MapRel8.Generic.RecordRel8.Generic.ReifyRel8.Kind.AlgebraRel8.Kind.Labels Rel8.OrderascdescRel8.Query.OpaleyeRel8.Schema.DictRel8.Schema.NullRel8.Schema.TableRel8.ColumnSchema ColumnSchemaRel8.Type.InformationDBTypeRel8.Type.Array Rel8.Type Rel8.Type.EqRel8.Schema.Spec Rel8.Schema.Spec.ConstrainDBTypeRel8.Schema.KindRel8.Schema.HTable.ProductRel8.Schema.ContextRel8.Schema.HTableRel8.Schema.HTable.MapTableRel8.Schema.HTable.NullifyRel8.Schema.HTable.LabelRel8.Schema.HTable.IdentityRel8.Schema.ResultRel8.Schema.Context.LabelRel8.Schema.ReifyRel8.Generic.Table.Record Rel8.Generic.Construction.RecordRel8.Schema.HTable.VectorizeRel8.Schema.HTable.NonEmptyRel8.Schema.HTable.ListRel8.Expr.OpaleyeRel8.Expr.SerializelitRel8.Expr.FunctionRel8.Expr.Bool Data.Boolboolwhere_Rel8.Expr.Null Data.Maybe isNothingisJust Rel8.Expr.EqRel8.Expr.ArrayRel8.Type.JSONBEncoded JSONEncodedRel8.Type.JSONEncoded Rel8.Type.Num Rel8.Type.OrdRel8.Type.EnumRel8.Type.ReadShowRel8.Type.SemigroupRel8.Type.MonoidRel8.Type.String Rel8.Type.Sum Rel8.Type.TagRel8.Schema.HTable.TheseRel8.Schema.HTable.MaybeRel8.Schema.HTable.EitherRel8.Generic.Table.ADTRel8.Generic.Table Rel8.TableExpr AggregateInsertRel8ableRel8.Table.Recontextualize Rel8.ExprRel8.Table.UndefinedRel8.Table.Serialize Rel8.Table.EqRel8.Table.BoolRel8.Table.Alternative MaybeTableRel8.Schema.NameRel8.Table.NameRel8.Statement.ReturningRel8.Expr.SequenceRel8.Expr.Order Rel8.Expr.OrdRel8.Table.OrdRel8.Table.OrderRel8.Aggregate aggregateRel8.Table.TagRel8.Table.OpaleyeRel8.Statement.UpdateRel8.Statement.InsertRel8.Statement.DeleteRel8.Query.ValuesunionRel8.Query.Set Rel8.QueryRel8.Query.OrderRel8.Query.LimitRel8.Query.Filter Control.MonadguardRel8.Query.Null catMaybesRel8.Query.SQLRel8.Statement.ViewRel8.Statement.SelectRel8.Query.EvaluatenextvalRel8.Query.EachRel8.Query.DistinctRel8.Schema.Context.NullifyRel8.Table.MaybetraverseMaybeTableRel8.Table.TheseData.These.CombinatorsisThisisThatisThesehasHerehasTherejustHere justThereRel8.Query.MaybeRel8.Query.ExistsRel8.Table.EitherRel8.Query.TheseRel8.Query.EitherRel8.Kind.ContextRel8.Table.UnreifyRel8.Table.NonEmptysomeRel8.Table.ListmanylistAggRel8.Expr.AggregateRel8.Table.AggregateRel8.Query.AggregateRel8.Query.ListControl.ApplicativeRel8.Column.TheseRel8.Column.NonEmptyRel8.Column.MaybeRel8.Column.ListRel8.Column.Either Rel8.ColumnRel8.Generic.Rel8ableRel8.Generic.Construction.ADTRel8.Generic.ConstructionRel8.Table.HKDRel8.Table.ADTRel8.Table.Rel8ableRel8.Type.CompositeRel8.Column.LiftRel8.Column.ADTRel8.Generic.Rel8able.TestOrderQuerySqlNullableNotNull TableSchemanameschemacolumnsTypeInformationencodedecodetypeNamemapTypeInformationparseTypeInformationtypeInformationDBEqHTableResult LabelableunsafeCastExpr unsafeLiterallitExprFunctionfunctionnullaryFunctionbinaryOperatorfalsetrue&&.||.not_and_or_boolExprcaseExprcoalescenullifyisNull isNonNullmapNull liftOpNullnull==./=.==?/=?in_ JSONBEncodedfromJSONBEncodedfromJSONEncoded DBFloating DBFractional DBIntegralDBNumDBMinDBMaxDBOrdEnumableDBEnum enumValue enumTypeNameEnumReadShow fromReadShow DBSemigroup<>.DBMonoid memptyExprDBStringDBSumTableColumnsContextUnreify toColumns fromColumnsreifyunreifyRecontextualize Serializable FromExprsToExprs fromResulttoResultEqTable==:/=:case_nullableAlternativeTable emptyTableAltTable<|>:SelectsNamenamesFromLabelsnamesFromLabelsWith ReturningNumberOfRowsAffected ProjectiontodaytoDayfromDayaddDaysdiffDays subtractDaysnowaddTimediffTime subtractTime scaleIntervalsecondsecondsminuteminuteshourhoursdaydaysweekweeksmonthmonthsyearyears++.~.~*!~!~* bitLength charLengthlower octetLengthupperasciibtrimchrconvert convertFrom convertToinitcapleftlengthlengthEncodinglpadltrimmd5pgClientEncoding quoteIdent quoteLiteral quoteNullable regexpReplaceregexpSplitToArrayrepeatreplacereverserightrpadrtrim splitPartstrpossubstr translate nullsFirst nullsLast<.<=.>.>=.?>=? leastExpr greatestExprOrdTableascTable descTable fromIntegral realToFracceilingdivmodfloorroundtruncate AggregatesUpdatetargetset updateWhere returningupdate$sel:into:Insert$sel:rows:Insert$sel:onConflict:Insert$sel:returning:Insert OnConflictAbort DoNothinginsertDelete$sel:from:Delete$sel:deleteWhere:Delete$sel:returning:DeletedeletevaluesunionAll intersect intersectAllexcept exceptAllorderBylimitoffsetfiltercatNull showQuery createViewselectEvaluateevalevaluateeachdistinct distinctOn distinctOnByisNothingTable isJustTable maybeTable nothingTable justTable$?nameMaybeTable TheseTable isThisTable isThatTable isThoseTable hasHereTable hasThereTable justHereTablejustThereTable thisTable thatTable thoseTable theseTablenameTheseTableoptional catMaybeTableexists whereExistswhereNotExistswithwithBywithout withoutBy EitherTable isLeftTable isRightTable eitherTable leftTable rightTablenameEitherTablealignBy keepHereTable loseHereTablekeepThereTableloseThereTable keepThisTable loseThisTable keepThatTable loseThatTablekeepThoseTableloseThoseTablebitraverseTheseTable keepLeftTablekeepRightTablebitraverseEitherTable NonEmptyTable nonEmptyTablenameNonEmptyTable ListTable listTable nameListTablecount countDistinct countStar countWhereandormaxminsumsumWhere stringAgg listAggExprnonEmptyAggExprgroupBy nonEmptyAgg countRowsmanyExprsomeExpr catListTablecatNonEmptyTablecatList catNonEmptyHThese HNonEmptyHMaybeHListHEitherColumn KRel8able AggregateHKDNameHKDDeconstructHKD ConstructHKDBuildHKDHKDableHKDTunHKDTHKDbuildHKD constructHKDdeconstructHKDnameHKD aggregateHKD AggregateADTNameADTDeconstructADT ConstructADTBuildADTADTableADTbuildADT constructADTdeconstructADTnameADT aggregateADT DBCompositecompositeFieldscompositeTypeName Compositecompose decomposeLiftHADTComposeEvalExp GMappablegmapgunmapGMapRecordunrecord GRecordablegrecord gunrecordGRecordARep KnownAlgebra algebraSingSAlgebraSProductSSumAlgebraProductSum KnownLabels labelsSingSLabelsSNilSConsLabels renderLabelsbaseGHC.Base<>Data.Functor.Contravariant Contravariant toOrderExprs fromOpaleye toOpaleye mapOpaleyezipOpaleyeWithDict HomonullableNullityNullNullify Unnullify GHC.MaybeNothingarraylistTypeInformationnonEmptyTypeInformationencodeArrayElementextractArrayElement $fDBTypeValue $fDBTypeUUID$fDBTypeByteString$fDBTypeByteString0 $fDBTypeCI $fDBTypeCI0 $fDBTypeText $fDBTypeText0$fDBTypeCalendarDiffTime$fDBTypeTimeOfDay$fDBTypeLocalTime $fDBTypeDay$fDBTypeUTCTime$fDBTypeScientific$fDBTypeDouble $fDBTypeFloat $fDBTypeInt64 $fDBTypeInt32 $fDBTypeInt16 $fDBTypeChar $fDBTypeBool KnownSpecspecSingSSpeclabelsinfonullitySpecConstrainDBType dbTypeNullity dbTypeDict nullifier unnullifierHContextHProductInterpretationCol htabulatehfieldhdictshspecs htraverseHFieldHConstrainTablehmap htabulateAMapSpecmapInfoHMapTableField Precompose precomposed HMapTable unHMapTableHNullifyhnullshnullify hunnullifyLabelHLabelhlabelhunlabel HIdentityHType unHIdentityRunRrelabel vectorizer unvectorizer HLabelablehlabeler hunlabelerlabeler unlabelerReifyNotReify UnwrapReifyhreifyhunreifynotReifyGToExprs gfromResult gtoResultGTablegtable gfromColumns gtoColumnsGContextGColumnsGConstructable gconstruct gdeconstruct Representable gtabulategindexGFields GConstruct GConstructor ToColumns FromColumns HVectorize hvectorize hunvectorizehappendhemptyHNonEmptyTable HListTablecastExpr scastExprsunsafeCastExpr fromPrimExpr toPrimExpr mapPrimExprzipPrimExprsWithtraversePrimExprtoColumn fromColumnslitExpr sparseValue nullableExprmaybefmapMaybeunsafeUnnullify nullableOfsnull unsafeMapNullunsafeLiftOpNullghc-prim GHC.Classes== GHC.TypesTrueBoolsappendsappend1semptyslistOf snonEmptyOflistOf nonEmptyOf$aeson-1.5.6.0-4Fai2YBAOjp98HRNOvB9PwData.Aeson.Types.ToJSONToJSONData.Aeson.Types.FromJSONFromJSONGHC.RealGHC.ReadReadGHC.ShowShowMonoidTagMaybeTagIsJust EitherTagIsLeftIsRightisLeftisRight HTheseTablehhereTaghhere hthereTaghthere HMaybeTablehtaghjust HEitherTablehlefthright GToExprsADTgfromResultADT gtoResultADT GTableADT' GTableADT gtableADTgfromColumnsADT gtoColumnsADT GColumnsADT' GColumnsADTGAlgebra GGContext GGColumns GGToExprsGGTable ggfromColumns ggtoColumnsggtable ggfromResult ggtoResult$fTablecontextCol$fTablecontextt CongruentTUnreifyTContextTColumnsTTableEunE undefinedTToExprsparseeqTableNunN showExprs showLabels showNames time-1.9.3Data.Time.Calendar.DaysDay<:<<=:<=>:>>=:>=leastgreatestordTable ApplicativepureAunA Aggregator operationordering distinction foldInputs mapInputsunsafeMakeAggregateTaggable aggregatorexpr fromAggregatefromExprfromName castTable binaryspec distinctspectable tableFields unpackspec valuesspecreturn$fAlternativeTableQuery$fAltTableQueryString sqlForQuerysqlForQueryWithNamesselectWithNames HNullifiable HConstrainTag hencodeTag hdecodeTag hnullifier hunnullifier Nullifiable ConstrainTag encodeTag decodeTagrunTagunnullJust$$fMonadMaybeTable$fApplicativeMaybeTabletagjust$these-1.1.1.1-71CAQUjvmPbAbyzAouGB4m Data.TheseTheseherethereinQuery Data.EitherEitherLeftRight Reifiable contextSingSContextSReify SAggregateSExprSNameSResult sReifiable sLabelableUnreifiabilityUResult Unreifiable Unreifiesunreifiability groupByExpr slistAggExprsnonEmptyAggExprhgroupByAHTheseNonEmpty AHNonEmptyAHMaybeAHListAHEitherTColumnAColumnTUnreifyContextGRepgunreifygreify GMakeableADTgmakeADTGConstructableADTgdeconstructADT gconstructADT gbuildADT gunbuildADTRepresentableFields gftabulategfindex GBuildADTRepresentableConstructors gctabulategcindex GConstructors GConstructADTGConstructorADT GGAggregateGGName GGDeconstruct GGConstructGGConstructableGGBuild GGBuildableggbuild ggconstruct ggdeconstructggname ggaggregateHKDRepConstructableHKD BuildableHKDfromHKDtoHKDADTRepConstructableADT BuildableADTfromADTtoADTALiftunALiftAHADT TableProduct$sel:foos:TableProduct$sel:list:TableProduct$sel:sum:TableProductTableSum TableSumC TableSumA TableSumB NonRecordHKDTest$sel:s3Object:HKDTest$sel:hkdSum:HKDTestHKDSumHKDSumCHKDSumAHKDSumBS3Object$sel:bucketName:S3Object$sel:objectKey:S3Object TableNest$sel:foo:TableNest$sel:bars:TableNest TableNonEmpty$sel:foo:TableNonEmpty$sel:bars:TableNonEmpty TableList$sel:foo:TableList$sel:bars:TableList TableThese$sel:foo:TableThese$sel:bars:TableThese TableEither$sel:foo:TableEither$sel:bars:TableEither TableMaybe$sel:foo:TableMaybe$sel:bars:TableMaybe TablePair$sel:foo:TablePair$sel:bars:TablePair TableTest$sel:bar:TableTest$sel:foo:TableTest