haskell-servant / haskell-servant/servant
How to model return types that depend on a Header value
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
I am primarily concerned with defining Apis for third party services, where an answer like "don't do that" does not apply.
My specific situation is where an endpoint returns fairly large type `Foo` with no special headers, but with a `X-Requested-With: XMLHttpRequest` header the return type is shrunk to just the `Bar` type.
It seems as though `Capture` has `Symbol` as it's static equivalent, so `Header` should ideally also have a static equivalent.
Contributor guide
Research direction
Start by examining how Capture provides Symbol as its static equivalent, then compare that design with Header in servant. Done means determining and documenting an appropriate static equivalent for Header that can model return types dependent on the X-Requested-With value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100