cdepillabout / cdepillabout/servant-checked-exceptions

NamedRoutes not implemented

Open
#40 4 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Haskell
Stars
75
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I’m trying to use the servant-checked-exceptions package with NamedRoutes. But I want to add the "Throws" at the top of the api, for instance:

```haskell
data ApiFoo mode = ApiFoo
{
get :: mode :- Get '[JSON] Foo
, post :: mode :- "new" :> ReqBody '[JSON] Foo :> Post '[JSON] ()
}

data ApiStore mode = ApiStore
{
fooStore :: mode :- "foo" :> NamedRoutes ApiFoo
, barStore :: mode :- "bar" :> NamedRoutes ApiBar

}

type API = Throws StoreError :> "store" :> NamedRoutes ApiStore
```

But `Throws` is not able to traverse NamedRoutes types. I tried to implement a `HasServer (Throwing '[e] :> NamedRoutes api)` instance, but I seem unable to do it correctly (I tried to find other packages that implement a similar instance too to use as example, in vain). I’d appreciate help for implementing that.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.