Commit Graph

56 Commits

Author SHA1 Message Date
Ollie Charles
bf193950ab
Require Opaleye >= 0.7.3 (#81)
0.7.3 has important changes to where lateral joins are introduced, and fixes #72.
2021-06-28 17:33:55 +01:00
Shane
4aa5ba952c
Remove Labelable type class; we don't really need labels at the type level anymore (#76) 2021-06-24 10:13:03 +00:00
Shane O'Brien
93da8410ac
Bump Opaleye dependency to 0.7.2.0 to take advantage of new EXISTS support 2021-06-22 12:46:09 +01:00
Ollie Charles
c887a7eb99 Release 1.0.0.1 2021-06-21 11:46:16 +01:00
Pranay Sashank
137ebeda89
Add homepage, bug-reports, source-repository meta to .cabal (#55) 2021-06-19 16:46:23 +01:00
Ollie Charles
1ad9d4b2d7 Add Changelog and README 2021-06-18 18:23:58 +01:00
Ollie Charles
74f03add78 Drop Rel8.Tabulate
While this is a great idea, right now the idea hasn't taken a form that we're confident enough in. To buy us a bit more time, we're removing it for now in order to release Rel8 1.0
2021-06-18 09:46:44 +01:00
Shane O'Brien
60cbc6a732
Add Rel8.Query.Evaluate 2021-06-17 18:17:31 +01:00
Shane O'Brien
1eaa683513
Get rid of defaulting and insert context altogether 2021-06-17 18:11:50 +01:00
Shane O'Brien
a9f500eb9e
Abandon Apply Aggregate experiment, support only Context Aggregate 2021-06-16 14:02:05 +01:00
Shane O'Brien
447508578d
Eliminate the need for Array1D (i.e., unify with [])
To implement the `DBType` instance for `[]`, we wrapped the underlying Postgres array with `ROW()`. This is to allow nesting `[]` inside `[]` (Postgres treats a bare `foo[][]` as a multidimensional array).

However, instead of unconditionally wrapping the list itself with `ROW()`, we could instead wrap individual list elements. And even better, we can wrap them *conditionally*, i.e., only if they have an array type (e.g., `foo[]`). This makes our lists much closer to Postgres arrays, and eliminates the need for `Array1D`. It also means our lists can be concatenated with a bare `||` operator; no need for the flaky `(foo).f1` unwrapping step.
2021-06-14 12:13:26 +01:00
Shane O'Brien
dc69cca54b
Remove implicit call to quietSnake; that's what namesFromLabelsWith is for 2021-06-12 12:13:19 +01:00
Shane O'Brien
2615b89eaf
Unify HType and HIdentity 2021-05-05 15:25:25 +01:00
Shane O'Brien
7a526b6ec1
Generalize constructor functions in Rel8.Table.ADT to Rel8.Generic.Construction 2021-05-05 03:14:22 +01:00
Shane O'Brien
2cdc3947e2
The guts of the new Generic construction machinery 2021-05-05 03:14:22 +01:00
Shane O'Brien
fab5b4e02d
Implement our own HKD in terms of the existing Generic machinery
This `HKD` is a better fit for `Rel8` than `higgledy`'s `HKD`. In a very literal sense, this `HKD` is now a `Rel8able` (i.e., `Context -> Type`), whereas `higgledy`'s is `(Type -> Type) -> Type`. This meant we had to use hacks like `HKD a (Compose Aggregate Expr)` to get a `HKD` into the `Aggregate` context (and similarly for `Insert`). Now we can just do `HKD a Aggregate` and `HKD a Insert` like any other `Rel8able`.

Like `higgledy`'s, our `HKD` is compatible with `generic-lens`.

One feature we have that `higgledy` doesn't is the ability to support sum types. You can make a `HKD` out of an arbitrary algebraic data type (whose fields are `DBType`s).

What's still missing is constructor/deconstructor machinery, but that's nearly finished, and the underlying machinery will also be used by the `ADT` `Rel8able`.
2021-05-05 03:14:22 +01:00
Shane O'Brien
4bc16d3451
Introduce ADT meta-Rel8able for sum types 2021-05-05 03:14:22 +01:00
Shane O'Brien
6e42c1ea63
Unfold Rel8.Schema.HKD into Rel8.Generic.HKD and Rel8.Column.Lift 2021-05-05 03:14:22 +01:00
Shane O'Brien
95a2ebf5e0
Unfold Rel8.Schema.Field into Rel8.Column.* 2021-05-05 03:14:21 +01:00
Shane O'Brien
6ecc65faf4
Remove obsolete Rel8.Schema.Structure 2021-05-05 03:14:21 +01:00
Shane O'Brien
356d591c6c
Fold Rel8.Schema.Context.Result into Rel8.Schema.Context 2021-05-05 03:14:21 +01:00
Shane O'Brien
66dc44da33
Teach Table and friends about Sum types 2021-05-05 03:14:21 +01:00
Shane O'Brien
6c20afa21d
Add Rel8.Generic.Table.ADT 2021-05-05 03:14:21 +01:00
Shane O'Brien
e432f6d068
Split greify and gunreify out of GTable
There is actually nothing specific to `reify` in the `Generic` version of these operations, they're actually just a specific instance of a much more general `gmap` operation. This now lives in `Rel8.Generic.Map`.
2021-04-28 12:12:31 +01:00
Shane O'Brien
1c73ec6814
Add reify and unreify to Table class
Previously these were implemented with `unsafeCoerce`, which was mostly correct, but was incorrect for certain instances of `HList`. With this change, `deriving Rel8able` will now fail to type check in those instances.
2021-04-27 17:04:40 +01:00
Shane O'Brien
1276bebbb0
Use FCF to decouple GTable from Table 2021-04-27 17:04:40 +01:00
Shane O'Brien
7c4c6ff930
Add Enum and Composite deriving via helpers 2021-04-18 21:34:50 +01:00
Shane O'Brien
fb2107513e
Add better generic deriving for EqTable, OrdTable and ToExprs
This builds upon the `Rel8.Generic.Record` machinery introduced in the previous commit. It means that we can use generic implementations of the `Table`, `EqTable`, `OrdTable` and `ToExprs` for all tuple types, rendering `HPair`, `HTrio`, `HQuartet` and `HQuintet` unnecessary (this commit removes them).
2021-04-18 16:35:48 +01:00
Shane O'Brien
6d3959e9b0
Allow generic deriving of Table instances for non-record types
The is implemented using new machinery in `Rel8.Generic.Record`, which transforms the generic representation of any type to be as if that type was a record. Numeric labels are assigned to anonymous field selectors like `_1`, `_2`, `_3` and so on.
2021-04-18 00:52:15 +01:00
Shane O'Brien
47e7842c0f
Sketch of HKD-lifting of Generic types 2021-04-16 15:17:39 +01:00
Shane O'Brien
04fdf2732d
Make Rel8able have kind ((X -> Type) -> Type) -> Constraint
Previous it was `((Type -> Type) -> Type) -> Constraint`. The problem is this clashes with things like `HKD` from `higgledy`. We can use GADTs and PolyKinds hacks to get around this while mostly retaining the same API. The only major difference is we use `Result` in places where we used `Identity` before.
2021-04-15 17:00:12 +01:00
Shane O'Brien
5e4df5096c
Complete overhaul of Rel8.Schema.Generic 2021-04-13 21:35:37 +01:00
Shane O'Brien
f1e287ea9f
Rename all the null things 2021-04-07 22:35:40 +01:00
Shane O'Brien
593e21b2df
Remove Opaque constraint synonyms 2021-04-07 21:39:03 +01:00
Ollie Charles
11e75b55df Require hasql ^>= 1.4.5.1
This allows TypeInformation to be coerced
2021-04-06 09:28:51 +01:00
Ollie Charles
9216dbd13d Remove doctest for now
Now that we're on Read the Docs, I think that will be a better home for
these examples. That, and nothing actually passes at the moment.
2021-04-02 19:20:10 +01:00
Ollie Charles
b97cd4efb7
Allow base-4.14 2021-04-02 18:40:29 +01:00
Ollie Charles
ac6ed40d7e
Update rel8.cabal 2021-04-02 17:40:16 +01:00
Shane O'Brien
5e1c9652da
Rename Rel8.Aggregate.{Context -> Legacy} but remove deprecated warning 2021-04-01 15:44:50 +01:00
Shane O'Brien
25c763807c
Add Rel8.Aggregate.Context for backwards compatibility 2021-04-01 15:13:11 +01:00
Shane O'Brien
e3bde04eba
Introduce more principled way to aggregate and name {Either,Maybe,These}Tables 2021-03-30 00:49:45 +01:00
Shane O'Brien
24f0521920
Fill in missing EqTable and OrdTable instances 2021-03-26 20:37:25 +00:00
Shane O'Brien
6cc3d1fdee
Expose Rel8.Expr.Num 2021-03-26 02:25:47 +00:00
Shane O'Brien
a335b79e77
Oops 2021-03-25 22:02:41 +00:00
Shane O'Brien
a363b05a33
Expose Rel8.Tabulate 2021-03-25 21:57:26 +00:00
Shane O'Brien
d0b51ef093
Remove Rel8.Query.Optimize 2021-03-25 19:37:44 +00:00
Shane O'Brien
bbfa1a32ed Allow Insert (rather than Insertion) to be used as a Context 2021-03-24 18:39:38 +00:00
Ollie Charles
5b3f06e95c Expose Rel8.Expr.{Text,Time} 2021-03-24 15:37:28 +00:00
Ollie Charles
d2347c1cbc Rewrite Nullify and Vectorize in terms of HMapTable 2021-03-24 14:56:57 +00:00
Ollie Charles
05564f4851 Only export Rel8 2021-03-24 13:04:21 +00:00