Mastodon Feed: Post

Mastodon Feed

dysfun@treehouse.systems ("gaytabase") wrote:

remember what i was saying about building a scope as you join? well we don't want to select a table by name, we want to select a table by alias.

with a little rearrangement of some things we can now write this, which is generic over the alias for the table (we just know the table is the descriptor Sample):

test : {aliases : RecordSpec TableDef} -> TableAlias "z" Sample aliases => Expr PInteger aliases
test = let x = "z"~>"a" in ?a1

of course in the common case you're probably not going to write such functions, you can just write it in a let block and have it all inferred.

hopefully 😅