module Managed.Connectors.HTTPConnector
  ( httpConnector
  , HTTPConnectorAPI
  , httpConnectorServer
  ) where

import Data.Managed (Agent, Connector(..))
import Data.Managed.Encodings.ShowRead
import Managed.Connectors.HTTPConnector.Internal
import qualified Network.Wai.Handler.Warp as Warp
import Servant (Server)

httpConnector :: Connector SR
httpConnector :: Connector SR
httpConnector = Connector :: forall e. (Agent e -> IO ()) -> Connector e
Connector {run :: Agent SR -> IO ()
run = Port -> Application -> IO ()
Warp.run Port
3000 (Application -> IO ())
-> (Agent SR -> Application) -> Agent SR -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Agent SR -> Application
mkApp}

type HTTPConnectorAPI = ManagedAPI

httpConnectorServer :: Agent SR -> Server ManagedAPI
httpConnectorServer :: Agent SR -> Server ManagedAPI
httpConnectorServer = Agent SR -> Server ManagedAPI
mkServer