added instance Generic BaseUrl
This commit is contained in:
parent
0e9d075ab4
commit
85aceadc60
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
module Servant.Client where
|
module Servant.Client where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -7,6 +8,7 @@ import Control.Monad.Catch
|
||||||
import Data.ByteString.Lazy
|
import Data.ByteString.Lazy
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
import Data.Text
|
import Data.Text
|
||||||
|
import GHC.Generics
|
||||||
import Network.HTTP.Client hiding (Proxy)
|
import Network.HTTP.Client hiding (Proxy)
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.URI
|
import Network.URI
|
||||||
|
@ -15,14 +17,14 @@ import System.IO.Unsafe
|
||||||
-- * Accessing APIs as a Client
|
-- * Accessing APIs as a Client
|
||||||
|
|
||||||
data Scheme = Http | Https
|
data Scheme = Http | Https
|
||||||
deriving (Show, Eq, Ord)
|
deriving (Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data BaseUrl = BaseUrl {
|
data BaseUrl = BaseUrl {
|
||||||
baseUrlScheme :: Scheme,
|
baseUrlScheme :: Scheme,
|
||||||
baseUrlHost :: String,
|
baseUrlHost :: String,
|
||||||
baseUrlPort :: Int
|
baseUrlPort :: Int
|
||||||
}
|
}
|
||||||
deriving (Show, Eq, Ord)
|
deriving (Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
httpBaseUrl :: String -> BaseUrl
|
httpBaseUrl :: String -> BaseUrl
|
||||||
httpBaseUrl host = BaseUrl Http host 80
|
httpBaseUrl host = BaseUrl Http host 80
|
||||||
|
|
Loading…
Reference in a new issue