Hi guys, I would like to run my API in this stack: MyApp a = ReaderT AppConfig (ExceptT ServantErr IO) a How do I need to configure the rest? I tried: type ServerW api = ServerT api HandlerW newtype HandlerW a = HandlerW { runHandlerW :: MyApp a } deriving ( Functor, Applicative, Monad, MonadIO, Generic , MonadError ServantErr , MonadThrow, MonadCatch ) type MyAPI = "api" :> "v1" :> Get '[JSON] [Perm] server :: ServerW MyAPI server = undefined Is this correct? With my attempt so far, I cannot combine different "ServerW" with the operator :<|> : server :: ServerW MyAPI server = Server1 :<|> Server2 • Couldn't match type ‘ReaderT AppConfig (ExceptT ServantErr IO) ()’ with ‘HandlerW Token’ Expected type: ServerW () Actual type: (MyApp ()) :<|> (MyApp ()) |
I found https://haskell-servant.readthedocs.io/en/stable/cookbook/using-custom-monad/UsingCustomMonad.html which might give me some answers :) On Tue, Nov 13, 2018 at 3:19 PM Corentin Dupont <[hidden email]> wrote:
|
Yes, this page along with the tutorial section about it (https://haskell-servant.readthedocs.io/en/stable/tutorial/Server.html#using-another-monad-for-your-handlers) give you examples of using `hoistServer`, which will let you convert all the handlers from your monad to Handler, which is what servant-server knows how to serve. Let us know here if you have any question though. On Tue, Nov 13, 2018 at 3:51 PM Corentin Dupont <[hidden email]> wrote:
Alp Mestanogullari
-- |
Free forum by Nabble | Edit this page |