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

Integrate MultiVerb into the servant packages #1766

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

theophile-scrive
Copy link

@theophile-scrive theophile-scrive commented Jul 1, 2024

This commit is Part 1 of the integration, where only the packages of this monorepo are touched.

MultiVerb is integrated alongside of the other Verb machinery, so that people may take their time to transition to it.


IsWaiBody will not be able to live in its current form, as it mixes concepts from the Server and Client packages.

This impacts SomeResponse, which itself impacts the HasClient and HasServer instances.
ResponseF can be replicated internally, even without the httpVersion field.
SomeResponse can be kept on the server, but the client can move to use ResponseF.


The IsResponse and IsResponseList classes are split between client-side Reponse{,List}Unrender and server-side Response{,List}Render.


This is a collaborative work between Scrive AB and Wire Swiss GmbH.

@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 3 times, most recently from b476b8f to 84ccbd0 Compare July 8, 2024 12:35
@theophile-scrive theophile-scrive changed the title Integrate MultiVerb into servant package Integrate MultiVerb into the servant package Jul 10, 2024
@theophile-scrive theophile-scrive changed the title Integrate MultiVerb into the servant package Integrate MultiVerb into the servant packages Jul 10, 2024
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 6 times, most recently from d10fc87 to 4ecb4ec Compare August 9, 2024 09:44
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 2 times, most recently from b7e31f0 to 77d471f Compare August 27, 2024 13:56
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 2 times, most recently from a61130b to 046d35f Compare August 28, 2024 22:06
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 11 times, most recently from 8be000f to 1a6b30d Compare August 29, 2024 20:16
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 2 times, most recently from 9e43f6e to 9835857 Compare August 29, 2024 21:52
@theophile-scrive theophile-scrive force-pushed the integrate-multiverb branch 2 times, most recently from 6d3234e to 3a84e18 Compare September 12, 2024 12:51
@theophile-scrive theophile-scrive marked this pull request as ready for review September 12, 2024 12:51
@theophile-scrive
Copy link
Author

@fisx @ysangkok I'd appreciate a review or questions if some things are not clear!

Copy link
Member

@fisx fisx left a comment

Choose a reason for hiding this comment

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

sorry for dropping the ball. here are some more comments. i'll continue with the review soon, i promise! :)

doc/cookbook/generic/Generic.lhs Show resolved Hide resolved
doc/cookbook/multiverb/MultiVerb.lhs Show resolved Hide resolved
doc/cookbook/multiverb/MultiVerb.lhs Outdated Show resolved Hide resolved
servant/src/Servant/API/MultiVerb.hs Show resolved Hide resolved
Copy link
Member

@fisx fisx left a comment

Choose a reason for hiding this comment

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

Sorry for the lag, but I think we're getting there!

Could you go through the unresolved comments one more time and confirm that you're ok with resolving all of them?

If so I'll approve this PR.

After that: @arianvp wanna give it a read, and maybe merge? @pcapriotti as the author of this code, do you have any feedback?

doc/cookbook/multiverb/MultiVerb.lhs Show resolved Hide resolved
servant/src/Servant/API/MultiVerb.hs Outdated Show resolved Hide resolved
servant/src/Servant/API/MultiVerb.hs Outdated Show resolved Hide resolved
servant-client/test/Servant/ClientTestUtils.hs Outdated Show resolved Hide resolved
@theophile-scrive
Copy link
Author

@pcapriotti @fisx I'd love your final feedback on this. :)

Copy link
Member

@jkarni jkarni left a comment

Choose a reason for hiding this comment

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

Nice feature, and very nice to read PR!

I made some comments, but none of them should be considered blocking!

doc/cookbook/multiverb/MultiVerb.lhs Show resolved Hide resolved
servant-client/test/Servant/ClientTestUtils.hs Outdated Show resolved Hide resolved
doc/cookbook/multiverb/MultiVerb.lhs Outdated Show resolved Hide resolved
--
-- Similar to 'Respond', but hardcodes the content type to be used for
-- generating the response.
data RespondAs ct (s :: Nat) (description :: Symbol) (a :: Type)
Copy link
Member

Choose a reason for hiding this comment

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

It feels a bit sad that there are two locations where a content-type may be specified, and they can be conflicting. It's not obvious to me what:

type Responses = '[ RespondAs 'HTML 200 "blah" Int ]
type API = MultiVerb  'GET '[JSON]   Responses     Result

Means, and why I should be allowed to say this.

Is there any reason to have this besides RespondEmpty? If not, maybe RespondEmpty can be it's own datatype?

Copy link
Author

Choose a reason for hiding this comment

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

Good call. @pcapriotti @fisx I'd like your input on this.

servant/src/Servant/Types/ResponseList.hs Outdated Show resolved Hide resolved
servant/src/Servant/API/TypeLevel/List.hs Show resolved Hide resolved
Copy link
Member

@fisx fisx left a comment

Choose a reason for hiding this comment

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

sorry for taking so incredibly long! 😳

This commit is Part 1 of the integration, where only the
`servant`Epackage is touched. `Verb` is redefined as an alias for
`MultiVerb1` inEorder to make the transition transparent to users of
`Verb`.
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.

5 participants