Skip to content

Instantly share code, notes, and snippets.

@abailly
Created August 28, 2017 14:23
Show Gist options
  • Save abailly/120ef06b72fb3a440526fb0bc009a134 to your computer and use it in GitHub Desktop.
Save abailly/120ef06b72fb3a440526fb0bc009a134 to your computer and use it in GitHub Desktop.
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