I would like to do a minor update to the RowCons documentation in Prim.hs:
RowCons l a i o can be read as o ~ { l :: a | i }
Perhaps also add a brief description saying what each of l, a, i and o represent. I know it took me a bit to figure out. I'll add a proposal for the changes tonight.
Additionally, we could probably use words for some of those type variables while we're at it:
class RowCons (label :: Symbol) (a :: Type) (in_row :: # Type) (out_row :: # Type) | [...]
Also, I've just realised this should probably wait until #3176 is merged, in order to avoid causing merge conflicts.
As mentioned i n the chat, it should be o ~ ( l :: a | i ), since it works for any row of types, not just records.
As RowCons also works with l o -> a i, I'd suggest tail and row instead of in_row and out_row. I feel this would be less confusing - than if you are using it this way but still have to read it as in and out.
Environment.hs changes from
class RowCons (l :: Symbol) (a :: Type) (i :: # Type) (o :: # Type) | l a i -> o, l o -> a i
to
class RowCons (label :: Symbol) (a :: Type) (tail :: # Type) (row :: # Type) | label a tail -> row, label row -> a tail
Prim.hs changes from
The RowCons type class is a 4-way relation which asserts that one row of types can be obtained from another by inserting a new label/type pair on the left.
to
The RowCons type class is a 4-way relation which asserts that one row of types can be obtained from a "tail" row by inserting a new label/type pair to the tail (
row ~ (label :: a | tail)).
Not super happy with _a "tail" row_ bit, but I'm not sure how to phrase it more elegantly. I'll wait with the PR until #3176 is merged.
Most helpful comment
Additionally, we could probably use words for some of those type variables while we're at it:
Also, I've just realised this should probably wait until #3176 is merged, in order to avoid causing merge conflicts.