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

[RFC] servant-elm-street #67

Open
chshersh opened this issue Mar 25, 2019 · 1 comment
Open

[RFC] servant-elm-street #67

chshersh opened this issue Mar 25, 2019 · 1 comment
Labels
question Further information is requested

Comments

@chshersh
Copy link
Contributor

TODO

@chshersh chshersh added the question Further information is requested label Mar 25, 2019
@googleson78
Copy link

googleson78 commented May 22, 2020

I'm trying something out here: https://github.com/googleson78/servant-elm-street

With the following approach for url segments + query params + headers:

Create a "stringifier" for types (similar to decoders and encoders) that works for integers, strings, enums and newtypes over all these (for now since these are the only things I'm currently using).
This relies on the user using Show/Read for their {To,From}HttpApiData instances, which could be made easier for DerivingVia usage like the ElmStreet newtype is for {To,From}JSON.

Use this stringifier to create segments/params/headers, with additionally supporting Maybe versions of these.

I don't know of a better approach than this "stringifier" thing, and looking at servant-elm they also seem to assume that their e.g. query parameters are always integers/strings.

I ended up copying a lot of code from elm-street - e.g. I need to know names of types and decoders/encoders so I can use them in my requests, so if this ends up working fine I might do a PR to expose these from here, if it's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants