haddocks for BaseUrl
This commit is contained in:
parent
77d52083f1
commit
f983734975
1 changed files with 15 additions and 8 deletions
|
@ -1,6 +1,9 @@
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
module Servant.Common.BaseUrl where
|
module Servant.Common.BaseUrl
|
||||||
|
( Scheme(..)
|
||||||
|
, BaseUrl (..)
|
||||||
|
) where
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
|
@ -8,15 +11,19 @@ import Network.URI
|
||||||
import Safe
|
import Safe
|
||||||
import Text.Read
|
import Text.Read
|
||||||
|
|
||||||
data Scheme = Http | Https
|
-- | URI scheme to use
|
||||||
|
data Scheme =
|
||||||
|
Http -- ^ http://
|
||||||
|
| Https -- ^ https://
|
||||||
deriving (Show, Eq, Ord, Generic)
|
deriving (Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
data BaseUrl = BaseUrl {
|
-- | Simple data type to represent the target of HTTP requests
|
||||||
baseUrlScheme :: Scheme,
|
-- for servant's automatically-generated clients.
|
||||||
baseUrlHost :: String,
|
data BaseUrl = BaseUrl
|
||||||
baseUrlPort :: Int
|
{ baseUrlScheme :: Scheme -- ^ URI scheme to use
|
||||||
}
|
, baseUrlHost :: String -- ^ host (eg "haskell.org")
|
||||||
deriving (Show, Eq, Ord, Generic)
|
, baseUrlPort :: Int -- ^ port (eg 80)
|
||||||
|
} deriving (Show, Eq, Ord, Generic)
|
||||||
|
|
||||||
showBaseUrl :: BaseUrl -> String
|
showBaseUrl :: BaseUrl -> String
|
||||||
showBaseUrl (BaseUrl urlscheme host port) =
|
showBaseUrl (BaseUrl urlscheme host port) =
|
||||||
|
|
Loading…
Reference in a new issue