haskell-servant / haskell-servant/servant
Combinator with fixed query param
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
I'm looking to write a Haskell program that depends on some API functions on [AlphaVantage](https://www.alphavantage.co/documentation/), and was thinking of trying out servant. However, the API is designed somewhat weirdly, with a single endpoint `query`, and a param `function` determining the remaining parameters to be taken in.
Is it possible to create a combinator with a fixed parameter (which I will name `QueryFixedParam`) that allows me to implement this API neatly? Such a combinator could work this way:
```haskell
type API = "query" :> QueryFixedParam "function" "TIME_SERIES_INTRADAY" :> ...
:<|> "query" :> QueryFixedParam "function" "TIME_SERIES_DAILY" :> ...
.
.
.
```
I'm very new to servant, so please let me know if there are better ways of implementing such an API. Thank you!
Contributor guide
Research direction
Start by reviewing servant's existing query-parameter combinators and the API type syntax shown in the issue. Determine whether a fixed function parameter can be represented for the AlphaVantage branches, or whether another API description is preferable. Done means the supported approach is implemented or the issue is clarified with a concrete alternative.
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
- 25/100