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

Are HasClient and HasClientMulti just the same? #112

Open
s9gf4ult opened this issue Oct 6, 2021 · 2 comments
Open

Are HasClient and HasClientMulti just the same? #112

s9gf4ult opened this issue Oct 6, 2021 · 2 comments

Comments

@s9gf4ult
Copy link
Contributor

s9gf4ult commented Oct 6, 2021

I am prepearing the PR with support for new features from servant-0.18* but just realized that there is module Servant.Reflex.Multi which consists of a lot of duplcation instances of HasClientMulti.

My concern is do HasClientMulti t m layout Identity tag just identical to HasClient t m layout tag?

Maybe it would be valuable to just remove all HasClient instances and replace the class with

type HasClient t m layout tag = HasClientMulti t m layout Identity tag

and fix according functions using HasClient like client?

@imalsogreg
Copy link
Owner

I think you're right. I added HasClientMulti later and did not want to disturb the original API, but I believe HasClientMulti t m layout Identity tag would work perfectly well in place of HasClient t m layout tag.

I wonder if there will be some difficulty implementing the function client in the non-multi case, if you make the proposed change. For instance, if we simply go ahead, will all the resulting client functions end up with parameters like Dynamic t (Either e (Identity a))? Is there a way for us to strip all those Identitys off for the API the end user sees?

If you can make this work, I'd definitely love a PR. The code duplication between non-multi and multi is really not nice.

@mniip
Copy link

mniip commented Dec 23, 2024

I would like to pose the opposite question: HasClientMulti _ _ _ f _ uses Applicative f to combine inputs, and Traversable f to sequence the accumulated requests, so is there anything it can do that cannot be achieved by simply lifting these operations outside and using regular HasClient ?

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

3 participants