Created
August 28, 2017 14:23
-
-
Save abailly/120ef06b72fb3a440526fb0bc009a134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MonadClient m where | |
performRequestCT :: Proxy ct -> method -> Req -> m a | |
instance MonadClient ClientM where | |
.... | |
instance OVERLAPPING_ | |
-- Note [Non-Empty Content Types] | |
( MonadClient m, MimeUnrender ct a, BuildHeadersTo ls, ReflectMethod method, cts' ~ (ct ': cts) | |
) => HasClient (Verb method status cts' (Headers ls a)) where | |
type Client (Verb method status cts' (Headers ls a)) | |
= m (Headers ls a) | |
clientWithRoute Proxy req = do | |
let method = reflectMethod (Proxy :: Proxy method) | |
(hdrs, resp) <- performRequestCT (Proxy :: Proxy ct) method req | |
return $ Headers { getResponse = resp | |
, getHeadersHList = buildHeadersTo hdrs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment