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

Concrete run method signatures in contexts #83

Merged
merged 1 commit into from
Mar 21, 2022
Merged

Conversation

deusaquilus
Copy link
Contributor

@deusaquilus deusaquilus commented Mar 21, 2022

In previous version of ProtoQuill there was no InternalApi and the run methods were used
on a context directly. This caused a problem where doing something like:

  val list: List[RightType] = run(query[WrongType])

Will yield:

  Found: ctx.Result[List[WrongType]] Required: List[RightType]

This was even worse if the types were more complex e.g. for ZIO:

  val list: ZIO[Has[DataSource], SQLException, List[RightType]] = run(query[WrongType])

Will yield:

  Found: QuillContext.Result[List[WrongType]] Required: ZIO[Has[DataSource], SQLException, List[RightType]]

This is quite confusing. Therefore we define the methods in an object and then
delegate to these in the individual contexts.

That way the correct type will be asked for:

Found: ZIO[Has[DataSource], SQLException, List[WrongType]] 
Required: ZIO[Has[DataSource], SQLException, List[RightType]]

@deusaquilus deusaquilus merged commit 38b0ef6 into master Mar 21, 2022
@deusaquilus deusaquilus deleted the better-signatures2 branch March 21, 2022 01:13
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

Successfully merging this pull request may close these issues.

1 participant