Commit Graph

279 Commits

Author SHA1 Message Date
Shane O'Brien
8febff7309
test 2021-06-14 15:54:29 +01:00
Shane O'Brien
d08428cdb4
runTabulation will never be sound as long as Tabulation is a Monad 2021-06-14 14:46:03 +01:00
Shane O'Brien
3017f59f7c
Always use ROW(NULL) and not NULL 2021-06-14 13:34:54 +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
bdb75e6580
Now that we have orderTabulation, I'm not sure we need listAggWithOrder and friends 2021-06-14 11:53:23 +01:00
Shane O'Brien
db40580450
Add singularize to Rel8.Tabulate 2021-06-14 10:01:23 +01:00
Shane O'Brien
06f34d20ee
Export emptyTable 2021-06-14 09:43:46 +01:00
Shane O'Brien
2a63c78f4c
Tweak Rel8.Tabulate so that optionalTabulation works with runTabulation 2021-06-14 09:39:16 +01:00
Shane O'Brien
43bf3a404b
Add headAgg aggregation function 2021-06-13 23:52:29 +01:00
Shane O'Brien
5a45f67ee3
Add orderTabulation 2021-06-13 19:53:48 +01:00
Shane O'Brien
4caf38d8f1
"Corep" is wrong. "Representable" is what I wanted. 2021-06-13 19:21:34 +01:00
Shane O'Brien
e15f3605bb
Rename Insertion to Create 2021-06-13 18:58:09 +01:00
Shane O'Brien
63c5e03dab
Rename Insertion constructor to Value 2021-06-13 17:56:48 +01:00
Shane O'Brien
0f76861520
Make all Col constructors single letter wrappers 2021-06-13 16:50:48 +01:00
Shane O'Brien
5824baa5cc
Parameterise Insertion by necessity 2021-06-13 16:01:47 +01:00
Shane O'Brien
89ec060e6f
Actually fix DBSemigroup instance for lists 2021-06-13 10:22:49 +01:00
Shane O'Brien
64e3fc52b7
Export DBEnum 2021-06-13 00:33:16 +01:00
Shane O'Brien
83466c9f26
Add DBEnum class for specifying enum value names for Enum 2021-06-12 22:57:01 +01:00
Shane O'Brien
b36091aeaa
Add DBMax and DBMin instances for Composite 2021-06-12 20:07:36 +01:00
Shane O'Brien
ca9f078c56
Fix DBSemigroup instances for [] and NonEmpty 2021-06-12 20:02:26 +01:00
Shane O'Brien
def349e6a7
Rewrite Composite in terms of HKD (allowing us to project fields) 2021-06-12 17:48:14 +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
4017859c0c
Add build{ADT,HKD} alternative to church encoded construct{ADT,HKD} 2021-06-11 14:15:54 +01:00
Shane O'Brien
8301eb79cd
A ListTable can't really have default values and HVectorize oughtn't preserve Necessity 2021-06-11 10:35:49 +01:00
Shane O'Brien
ae2ce41f86
Make constructHKD work the same for product and sum types 2021-06-10 19:37:24 +01:00
Shane O'Brien
bdf2d87fdf
Add manyExpr and someExpr 2021-06-05 10:57:33 +01:00
Shane O'Brien
08dea9fa90
Add Floating instance for Expr 2021-05-20 09:36:07 +01:00
Shane O'Brien
e48c73e1e9
Add someTabulation and manyTabulation 2021-05-06 23:05:54 +01:00
Shane O'Brien
8cb6d48807
Generalize nullable to work on Tables 2021-05-06 18:26:12 +01:00
Shane O'Brien
d028b37ed4
Changes necessary to allow nesting Lift and HADT inside ListTable 2021-05-06 01:10:09 +01:00
Shane O'Brien
5b1faf2efc
Export fromADT, toADT, fromHKD and toHKD 2021-05-06 00:30:28 +01:00
Shane O'Brien
f8b1a5514e
Better unreification; allow more nesting inside HLists 2021-05-05 23:57:46 +01:00
Shane O'Brien
2615b89eaf
Unify HType and HIdentity 2021-05-05 15:25:25 +01:00
Shane O'Brien
db148ff18d
Simplify Labels 2021-05-05 15:04:59 +01:00
Shane O'Brien
cfe8a70a22
Don't try to cram ADT into Rel8able 2021-05-05 14:30:22 +01:00
Shane O'Brien
666f0b94a0
Try to fix compile error? 2021-05-05 12:16:48 +01:00
Shane O'Brien
d07e3b5cfc
Add and export missing constructors for MaybeTable and friends 2021-05-05 03:14:23 +01:00
Shane O'Brien
8a680c99c3
Reverse dependency between MaybeTable (and friends) and Serializable 2021-05-05 03:14:23 +01:00
Shane O'Brien
45f6f2b862
Rearrange parameters of ggaggregate 2021-05-05 03:14:22 +01:00
Shane O'Brien
cf8bdc7a0c
Add constructors for HKD 2021-05-05 03:14:22 +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
9fd885fc3f
Include both Apply and "Legacy" variants of aggregateADT 2021-05-05 03:14:22 +01:00
Shane O'Brien
845516adbd
Add constructADT, deconstructADT, nameADT, insertADT, aggregateADT to Rel8.Table.ADT 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
23bb65b24b
Drop Encodes and litTable, they don't seem necessary 2021-05-05 03:14:22 +01:00
Shane O'Brien
fb3d2d9caf
Add EqTable and OrdTable instances for HKD 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