@@ -1,5 +1,6 @@
1{-# LANGUAGE TypeFamilies #-}
1{-# LANGUAGE TypeFamilies #-}
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE DeriveGeneric #-}
3module Servant.Client where
4module Servant.Client where
5import Control.Concurrent
6import Control.Concurrent
@@ -7,6 +8,7 @@ import Control.Monad.Catch
7import Data.ByteString.Lazy
8import Data.ByteString.Lazy
8import Data.Proxy
9import Data.Proxy
9import Data.Text
10import Data.Text
10import Network.HTTP.Client hiding (Proxy)
12import Network.HTTP.Client hiding (Proxy)
11import Network.HTTP.Types
13import Network.HTTP.Types
12import Network.URI
14import Network.URI
@@ -15,14 +17,14 @@ import System.IO.Unsafe
15-- * Accessing APIs as a Client
17-- * Accessing APIs as a Client
17data Scheme = Http | Https
19data Scheme = Http | Https
18− deriving (Show, Eq, Ord)
20+ deriving (Show, Eq, Ord, Generic)
20data BaseUrl = BaseUrl {
22data BaseUrl = BaseUrl {
21 baseUrlScheme :: Scheme,
23 baseUrlScheme :: Scheme,
22 baseUrlHost :: String,
24 baseUrlHost :: String,
23 baseUrlPort :: Int
25 baseUrlPort :: Int
25− deriving (Show, Eq, Ord)
27+ deriving (Show, Eq, Ord, Generic)
27httpBaseUrl :: String -> BaseUrl
29httpBaseUrl :: String -> BaseUrl
28httpBaseUrl host = BaseUrl Http host 80
30httpBaseUrl host = BaseUrl Http host 80