haskell-servant / haskell-servant/servant
Allow effects in `AuthenticatedRequest`
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
servant-client's `AuthenticatedRequest` is a newtype wrapping auth data as well as a way to modify a request:
```haskell
newtype AuthenticatedRequest a =
AuthenticatedRequest { unAuthReq :: (AuthClientData a, AuthClientData a -> Request -> Request ) }
```
This works well in many cases, but the `Request` modification function has to be pure, which is not enough in some cases (eg signing the `Request` requires a random nonce, or including a timestamp in the signature).
I've started exploring the following solution (`m` being destined to be ultimately bound with the `m` from `Client m`):
```haskell
newtype AuthenticatedRequest m a =
AuthenticatedRequest { unAuthReq :: (AuthClientData a, AuthClientData a -> Request -> m Request ) }
```
But I'm not sure if it's feasible to write the `HasClient` instance for `AuthProtect` in this context though.
Contributor guide
Assessment
This issue has not been assessed yet.