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

Add apply for F[_] services #16

Merged
merged 8 commits into from
Dec 30, 2021
Merged

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented Dec 27, 2021

No description provided.

@Baccata
Copy link
Contributor

Baccata commented Dec 27, 2021

I'd rather not merge it as is : I'd like for the Gen companion to retain an unbiased nature towards the various kinds the service could take.

Any idea how we could solve it differently ?

@Baccata
Copy link
Contributor

Baccata commented Dec 27, 2021

We could possibly do it like CE does, and come up with a bunch of DummyImplicits types that'd match the kinds we're trying to expose.

I don't think the F[_] kinded type alias should be used though.

@@ -4,11 +4,26 @@ package object example {
val NAMESPACE: String = "smithy4s.example"

type StreamedObjects[F[_]] = smithy4s.Monadic[StreamedObjectsGen, F]
val StreamedObjects : smithy4s.Service[StreamedObjectsGen, StreamedObjectsOperation] = StreamedObjectsGen
object StreamedObjects extends smithy4s.Service.Provider[StreamedObjectsGen, StreamedObjectsOperation] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think turning it into an object might help metals ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, it should help autoimport!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaaaaand it does.

@Baccata
Copy link
Contributor

Baccata commented Dec 28, 2021

@kubukoz when you have time, would you mind trying this encoding in your project ?

@@ -47,12 +48,16 @@ trait Service[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _]] extends Transformable[Al

def transform[P[_, _, _, _, _]](transformation: Transformation[Op, P]): Alg[P]

def asTransformation[F[_]](impl: Monadic[Alg, F]): Interpreter[Op, F] = asTransformationGen[GenLift[F]#λ](impl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're gonna break compat and bump minor, I want to remove this one which is biased towards F[_] kinds. Ideally, I want the bias to be centralised in the package object, so that we can easily offer some customisability there without impacting the main code generation template.

@kubukoz
Copy link
Member Author

kubukoz commented Dec 28, 2021

Works like a charm :)

@Baccata Baccata merged commit c901607 into disneystreaming:main Dec 30, 2021
Baccata added a commit that referenced this pull request May 10, 2022
Creates a `Service.Provider` interface and use that in places, to increase flexibility and convenience of type aliases to generated services

Co-authored-by: Olivier Mélois <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants