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

formatMany is partial for no good reason #129

Open
Profpatsch opened this issue Nov 3, 2023 · 0 comments
Open

formatMany is partial for no good reason #129

Profpatsch opened this issue Nov 3, 2023 · 0 comments

Comments

@Profpatsch
Copy link

We’ve had production issues because of:

formatMany :: (ToRow q) => Connection -> Query -> [q] -> IO ByteString
formatMany _ q [] = fmtError "no rows supplied" q []
formatMany conn q@(Query template) qs = do

I think the function signature should be changed to:

formatMany :: (ToRow q) => Connection -> Query -> NonEmpty q -> IO ByteString

The breaking change is pretty much worth it, because anybody using this function that does not put a check (trivial to get wrong) will have a sleeping bug that blows up at the worst times.

@Profpatsch Profpatsch changed the title formatMany is partial with no good reason formatMany is partial for no good reason Nov 3, 2023
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