haskell-beam / haskell-beam/beam

A variant of select that doesn't require QBaseScope

Open
#652 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

Wouldn't it be completely safe to have a variant of the `select` function with the following signature:
```
select' :: forall s be db res.
(BeamSqlBackend be, HasQBuilder be, Projectible be res) =>
Q be db s res ->
SqlSelect be (QExprToIdentity res)
```

I.e. one that doesn't insist on having `QBaseScope`. I know this is an odd thing to want, but I find myself writing higher order `beam` utilities that involve passing query fragments around, and they play better with type inference when the types are as monomorphic as possible and sometimes that requires me to `select` a `Q be db (QNested something) res`. If I understand the purpose of `QNested` correctly, it's not safe to cast a `Q be db (QNested QBaseScope) res` to a `Q be db QBaseScope res` in general, but it _should_ be safe to `select` a `Q be db (QNested QBaseScope) res`, right? If my assumption is correct, having that `select` variant would enable some advanced use cases for me.

I know I could just copy-paste the implementation of `select` and give it the type I want, but I want to confirm here that it is indeed a safe thing to do.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.