Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make version of mkGetter with polymorphic input #80

Open
brandon-leapyear opened this issue Jan 28, 2022 · 0 comments
Open

Make version of mkGetter with polymorphic input #80

brandon-leapyear opened this issue Jan 28, 2022 · 0 comments

Comments

@brandon-leapyear
Copy link
Contributor

brandon-leapyear commented Jan 28, 2022

mkGetter' "Node" "getNodes" ".nodes[]"

should work for any object with a nodes key.

Could be implemented with a helper that generates the type of the input of

[get| .foo[].bar |]

e.g.

getFoo :: [has| .foo[].bar |] ->

Specifically,

getFoo :: [has| .s |] -> [unwrap| MySchema.s |]
getFoo = [get| .s |]

should be valid for any schema MySchema and any query path s

Currently workaround-able with

getFoo ::
  ( s1 ~ LookupSchema "a" schema
  , Maybe (Object r1) ~ SchemaResult s1
  , s2 ~ LookupSchema "b" r1
  , [Object r2] ~ SchemaResult s2
  , s3 ~ LookupSchema "c" r2
  , Int ~ SchemaResult s3
  , Typeable s1
  , Typeable s2
  , Typeable s3
  , Typeable r1
  , Typeable r2
  ) =>
  Object schema ->
  [Int]
getFoo = [get| .a!.b[].c |]

Possibly related to #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant