{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Servant.RawM.Client (
module Servant.RawM
) where
import Data.Proxy (Proxy (Proxy))
import Servant.Client.Core (Client,
HasClient (clientWithRoute, hoistClientMonad),
Request, Response, RunClient, runRequest)
import Servant.RawM
instance RunClient m => HasClient m (RawM' serverType) where
type Client m (RawM' serverType) = (Request -> Request) -> m Response
clientWithRoute
:: Proxy m
-> Proxy (RawM' serverType)
-> Request
-> Client m (RawM' serverType)
clientWithRoute Proxy Proxy req reqFunc = runRequest $ reqFunc req
hoistClientMonad
:: Proxy m
-> Proxy (RawM' serverType)
-> (forall x. mon x -> mon' x)
-> Client mon (RawM' serverType)
-> Client mon' (RawM' serverType)
hoistClientMonad Proxy Proxy f cl = f . cl