haskell-servant / haskell-servant/servant
doubt about the main example in the tutorial
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
In the [More endpoints](https://docs.servant.dev/en/stable/tutorial/Server.html) section of the chapter "Serving an API", we define a type:
```
type UserAPI2 = "users" :> Get '[JSON] [User]
:<|> "albert" :> Get '[JSON] User
:<|> "isaac" :> Get '[JSON] User
```
and then serve the data:
```
server2 :: Server UserAPI2
server2 = return users2
:<|> return albert
:<|> return isaac
```
This seems to be error-prone, as I could easily flip, by accident, the two lines `:<|> return albert` and `:<|> return isaac` . This would compile fine, leading to great awkwardness at runtime.
Is there a better way of doing this, especially when there are many endpoints?
Contributor guide
Assessment
This issue has not been assessed yet.