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

Incoherent parameter order #30

Open
hadronized opened this issue Aug 25, 2017 · 1 comment
Open

Incoherent parameter order #30

hadronized opened this issue Aug 25, 2017 · 1 comment

Comments

@hadronized
Copy link
Contributor

I have an endpoint that mixes both ReqBody and QueryParams:

filterOccurrences :: [Tag] -> [QueryFilter] -> 

However, the generated Elm reverses the order:

postOccurrencesFiltered : List (QueryFilter) -> List (String) -> Http.Request

It’s clearly not a big deal, but it’s confusing and error prone (I can’t imagine the madness if both the arguments resolve to the exact same type).

@mattjbray
Copy link
Collaborator

The functions generated by servant-elm take parameters in the following order:

  1. Headers
  2. URL path captures
  3. URL query args
  4. Request body

Since we use servant-foreign's listFromAPI, we don't know the order in which they were defined in the original type.

Perhaps this would be a valuable addition to servant-foreign - I'll put something together.

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 a pull request may close this issue.

2 participants