-
Notifications
You must be signed in to change notification settings - Fork 471
Closed as not planned
Labels
staleOld issues that went staleOld issues that went stale
Description
14 │
15 │ type rec selectionList<, > =
16 │ | []: selectionList<'a, 'a>
17 │ | ::(column<'a>, selectionList<'b, 'c>): selectionList<'b, 'a => 'c>
18 │
I'm not sure what to parse here when looking at ":".
This is used in https://github.com/sikanhe/reason-graphql for inferring GraphQL resolver argument types. It uses the trick where for each item you add to the diff list, the resolver gets an additional argument.
field("field",
~args=[arg("count", ~typ=int), arg("foo", ~typ=string)],
~resolver=(ctx, count: int, foo: string) => {
// we get safely typed `count` and `foo` inside resolver fn body
}
)
I am also currently working on a library that does a similar trick for SQL selects - when change the columns selected, the row mapper of the query results changes with it.
select([User.name, User.age], ~mapRow=(name: string, age: int) => { // type safe rows returned here }
GADT can be complicated topic - but in rare (but very practical) use cases they provide a much better api than alternatives
idkjs, fhammerschmidt, mxthevs and glennslyawaramin, tsnobip, fhammerschmidt and mxthevs
Metadata
Metadata
Assignees
Labels
staleOld issues that went staleOld issues that went stale