-- | Convert a Happstack 'H.ServerPart' to a WAI 'W.Application'.
toApplication :: H.ServerPart H.Response -> W.Application
toApplication sp wReq = do
  hReq <- convertRequest wReq
  hResp <- liftIO $ H.simpleHTTP'' sp hReq
  additionalHeaders <- liftIO standardHeaders
  return $ convertResponse additionalHeaders hResp

-- | Run a 'H.ServerPart' on warp at the specified port.
toApplication :: H.ServerPart H.Response -> W.Application
toApplication sp wReq = do
  hReq <- convertRequest wReq
  hResp <- liftIO $ H.simpleHTTP'' sp hReq
  additionalHeaders <- liftIO standardHeaders
  return $ convertResponse additionalHeaders hResp

-- | Run a 'H.ServerPart' on warp at the specified port.
toApplication sp wReq = do
  hReq <- convertRequest wReq
  hResp <- liftIO $ H.simpleHTTP'' sp hReq
  additionalHeaders <- liftIO standardHeaders
  return $ convertResponse additionalHeaders hResp

-- | Run a 'H.ServerPart' on warp at the specified port.