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

Porter.Multi #9

Merged
merged 4 commits into from Jul 4, 2018

Conversation

Projects
None yet
2 participants
@Qqwy
Contributor

Qqwy commented Jul 2, 2018

This PR adds the Porter.Multi module that allows using requests with specialized response types.

Note that I've had to split off some functionality to a Porter.Internals module to prevent dependency cycles. I am not very happy that these things are theoretically visible to the user (The Porter.Internals module has to expose them for the other two modules to use it). If you know a way to improve this, that would be nice.

EDIT: I now know that as long as you do not add a module to the exposed-modules of the package information, it will not be visible outside the package. So this is not a problem at all! 😄

  • Porter.Multi basic functionality of specialized return types
  • Porter.Multi.andThen chaining
  • Porter.Multi.map, map2, map3
  • Making sure old Porter setup is enough to use the new library (adding a new type variant to Porter.Msg and a new clause to the update function to match).
  • Altering the casing of variable names (which is the method I use) to dromedarisCase (which is what Porter, i.e. @peterszerzo uses).
  • A Porter.Multi.fromSimple call that turns a normal Porter.Request into a Porter.Multi.Request
  • example code that uses Porter.Multi
@Qqwy

This comment has been minimized.

Show comment
Hide comment
@Qqwy

Qqwy Jul 3, 2018

Contributor

I've added a call that turns a normal Porter request into a Porter.Multi request, for compatibility's sake :-)

Contributor

Qqwy commented Jul 3, 2018

I've added a call that turns a normal Porter request into a Porter.Multi request, for compatibility's sake :-)

, send
)
{-| With `Porter.Multi` you can create requests that have specialized return values.

This comment has been minimized.

@peterszerzo

peterszerzo Jul 4, 2018

Owner

In order to make sure newcomers to the library don't jump straight to this module and get frustrated, I think it makes sense to start this documentation saying something like This is an advanced version of the Porter module that covers ... For most use-cases, using Porter should be sufficient. If, however, you have a tangible issue with expressing chaining and transformations with your port messages, read along :).

I feel like your use-case is on the advanced side, and it would be nice to make sure people don't jump in straight away unless it gives them a real benefit.

@peterszerzo

peterszerzo Jul 4, 2018

Owner

In order to make sure newcomers to the library don't jump straight to this module and get frustrated, I think it makes sense to start this documentation saying something like This is an advanced version of the Porter module that covers ... For most use-cases, using Porter should be sufficient. If, however, you have a tangible issue with expressing chaining and transformations with your port messages, read along :).

I feel like your use-case is on the advanced side, and it would be nice to make sure people don't jump in straight away unless it gives them a real benefit.

This comment has been minimized.

@Qqwy

Qqwy Jul 4, 2018

Contributor

This change has been made. I hope the wording I ended up using meets your expectations :-).

@Qqwy

Qqwy Jul 4, 2018

Contributor

This change has been made. I hope the wording I ended up using meets your expectations :-).

@peterszerzo peterszerzo merged commit 2073579 into peterszerzo:master Jul 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment