Closed abigailalice closed 2 months ago
If you want to store a List table in a Rel8able, try using HList. That has special support for using ListTable with Expr and [] with Result. Does that help?
Yeah, that seemed to work, though I'm still left wondering why tupling the ListTable
didn't experience the same problem. But I suppose it's not really important as long as I know how to avoid it. Thanks.
It's unfortunately very difficult to make what you want work. If we have a Query (ListTable expr a)
, we really want the result here to be a [a']
- having to work through some other list type would (imo) kinda suck. So this means we need ListTable to select into []
. But in your record, that ListTable
appears without any wrapping, which means we can't make the same mapping. This is why it tries to produce a ListTable Expr
, but that's contradictory (because a Foo Expr
Rel8able
has to select to Foo Result
). So unfortunately this is all rather "due to technical reasons", which I never like as an answer... But this is the best solution we know about for now!
I guess I'll close this then, I did find the stuff in the documentation in HList
mentioning storing it in tables. I might work on adding examples of things like this to the cookbook.
I encountered this type error recently while trying to store a
ListTable
within one of my table schemas, defined sort of likeThis was kind of confusing, as I'd assumed these were the same types. I was still able to get my code to work, simply by splitting up the
SomeTable
data type into its individual fields after selecting it witheach
, and returning them in a tuple, rather than in theSomeTable
constructor.My main question is is this working by design, or something preventing type inference, or something else? I've used
many
plenty to returned nested tables, and never encountered any issues, which is why I thought the types were equivalent. Though this is the first time I've ever stored aListTable
within a schema, which seems relevant, since it's only when I tried to work with aSomeTable Result
that theListTable Result
stopped being a list.