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

Allow Codec#product to behave correctly with parameter count #94

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

s5bug
Copy link

@s5bug s5bug commented Feb 21, 2024

The way this is implemented is via a parameters: Int on Encoder.

Notes:

  • The State[Int, String] solution from Skunk was attempted, but there was no way to prevent the bad behavior of (someNonUnit, Codec.unit).tupled from generating (?, ?, ?,) rather than (?, ?, ?). A possible solution to this issue is State[Int, List[Either[String, Int]]], where the transitions Left→Left, Left→Right, Right→Left are directly concatenated, but transitions Right→Right are joined with , .
  • For some reason the string interpolator doesn't like ${ a *: b *: nil }, and I don't know why.
  • It's not exactly clear how to handle Encoder#either in this case.
  • I refactored the base types into a common superclass so I wouldn't have to write def parameters = 1 6 times.

@s5bug
Copy link
Author

s5bug commented Feb 21, 2024

The latest commit addresses point 1, with the Fragment.Part ADT.

@armanbilge armanbilge closed this Feb 21, 2024
@armanbilge armanbilge reopened this Feb 21, 2024
@s5bug
Copy link
Author

s5bug commented Feb 21, 2024

JS support blocked by WiseLibs/better-sqlite3#1032

creates a binding dictionary explicitly on JS, zipping the arguments with their index and binding str(idx+1) to the argument
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.

None yet

2 participants