haskell-servant / haskell-servant/servant

servant-client with BasicAuth

Open
#1,207 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
2k
Forks
427
Avg merge
2d 23h
Merged PRs (30d)
5

Description

Hi.

So I have an API as following:

```haskell
type MyAPI = BasicAuth "standard" ApiUser :> (EndpointA :<|> EndpointB :<|> EndpointC)
```

In order to produce a client from this, it seems I have to go through the extra pain of writing:

```haskell
clientA user = case cf user of
clientA' :<|> _ :<|> _ -> clientA'

clientB user = case cf user of
_ :<|> clientB' :<|> _ -> clientB'

clientC user = case cf user of
_ :<|> _ :<|> clientC' -> clientC'

cf = client (Proxy @MyAPI)
```

Having to pattern match repeatedly is very cumbersome (and requires modifying *every* endpoint if a single endpoint gets added).
Am I doing this wrong? Is there a combinator I'm not seeing?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.