@@ -13,6 +13,36 @@
1313* [Contribution](#contribution)
1414* [License](#license)
1515
16+```haskell
17+{-# LANGUAGE OverloadedStrings #-}
18+{-# OPTIONS_GHC -fno-warn-orphans #-}
19+
20+module Main (main) where
21+
22+import Control.Exception (throwIO)
23+import Network.HTTP.Req
24+import Data.Aeson
25+
26+-- Just make your monad stack an instance of MonadHttp in your application
27+-- and start making requests, enjoy automatic connection sharing.
28+
29+instance MonadHttp IO where
30+ handleHttpException = throwIO
31+
32+main :: IO ()
33+main = do
34+ let payload = object
35+ [ "foo" .= (10 :: Int)
36+ , "bar" .= (20 :: Int) ]
37+ -- One function, full power and flexibility.
38+ r <- req POST -- method
39+ (https "httpbin.org" /: "post") -- safe by construction URL
40+ (ReqBodyJson payload) -- use built-in options or add your own
41+ jsonResponse -- specify how to interpret response
42+ mempty -- query params, headers, explicit port number, etc.
43+ print (responseBody r :: Value)
44+```
45+
1646This is an easy-to-use, type-safe, expandable, high-level HTTP library that
1747just works without any fooling around.
1848