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

toBaseId for Maybes #132

Open
jkarni opened this issue Mar 7, 2016 · 2 comments
Open

toBaseId for Maybes #132

jkarni opened this issue Mar 7, 2016 · 2 comments

Comments

@jkarni
Copy link

jkarni commented Mar 7, 2016

toBaseId is great, but doesn't really work on e.g. a left inner join, since there's no way of pushing the Maybe in. It's easy enough to define:

toBaseIdM :: ToBaseId ent => expr (Value (Maybe (Key ent))) -> expr (Value (Maybe (Key (BaseEnt ent))))

For expr ~ SqlExpr (it's the same implementation as toBaseId),. Should I submit a PR for it? It seems a little ugly to have two altogether separate class methods for this...

@meteficha
Copy link
Member

I'm not sure what's best as well. What's your opinion, @pseudonom?

@pseudonom
Copy link
Contributor

I haven't actually investigated if this is possible/non-enormous, but would it make sense to make a version of when_/case_ that knew about NULL and Maybe? So that an expr (Value (Maybe typ)) becomes an expr (Value typ) in the appropriate branch?

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