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

Experimental: ToAlias(Reference)T doesn't evaluate for Maybes #193

Closed
googleson78 opened this issue Jul 10, 2020 · 2 comments
Closed

Experimental: ToAlias(Reference)T doesn't evaluate for Maybes #193

googleson78 opened this issue Jul 10, 2020 · 2 comments

Comments

@googleson78
Copy link
Contributor

googleson78 commented Jul 10, 2020

I got the following error today:

 Could not deduce: Exp.ToAliasReferenceT
                      (Exp.ToAliasT (SqlExpr (Maybe (Entity Thing))))
                    ~ SqlExpr (Maybe (Entity Thing))
    arising from a functional dependency between:
      constraint Database.Esqueleto.Internal.Internal.SqlSelect
                    (Exp.ToAliasReferenceT
                       (Exp.ToAliasT (SqlExpr (Maybe (Entity Thing)))))
                    (Maybe (Entity Thing))
        arising from a use of select

Is this an oversight in Experimental stuff, or am I trying to do something impossible/stupid?

Context is roughly as follows: I have a (nonempty) list of queries, all of which have a left outer join (with Thing being on the right side of the join), over which I'm doing a foldl1 Union

Basically this thing:

xs :: [B]
f :: B -> SqlQuery (SqlExpr (Entity C), SqlExpr (Maybe (Entity Thing))) -- this Thing is the same one from above

...
... <- select $ Experimental.from $ List.foldl1' Union $ map (SelectQuery . f) xs -- errors here
...
@parsonsmatt
Copy link
Collaborator

@belevy this seems like it should work, any idea what's going on?

@belevy
Copy link
Collaborator

belevy commented Jul 10, 2020

Looks like an oversight in the type families. I might be able to take a look today.

EDIT: this only effects Entities. Values work fine. I will add this into my 3.3.3.3 patch which I guess is just now a bugfix roll-up.

belevy added a commit to foxhound-systems/esqueleto that referenced this issue Jul 10, 2020
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

3 participants