git.iko.soy/typeable/servant
on master help sign in
haddocks for BaseUrl
f983734Alp Mestanogullari
src/Servant/Common/BaseUrl.hs+15−8
@@ -1,6 +1,9 @@
1{-# LANGUAGE DeriveGeneric #-}
1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE ViewPatterns #-}
2{-# LANGUAGE ViewPatterns #-}
3−module Servant.Common.BaseUrl where
3+module Servant.Common.BaseUrl
4+ ( Scheme(..)
5+ , BaseUrl (..)
6+ ) where
4
7
5import Data.List
8import Data.List
6import GHC.Generics
9import GHC.Generics
@@ -8,15 +11,19 @@ import Network.URI
8import Safe
11import Safe
9import Text.Read
12import Text.Read
10
13
14+-- | URI scheme to use
11−data Scheme = Http | Https
15+data Scheme =
16+ Http -- ^ http://
17+ | Https -- ^ https://
12 deriving (Show, Eq, Ord, Generic)
18 deriving (Show, Eq, Ord, Generic)
13
19
20+-- | Simple data type to represent the target of HTTP requests
21+-- for servant's automatically-generated clients.
14−data BaseUrl = BaseUrl {
22+data BaseUrl = BaseUrl
15− baseUrlScheme :: Scheme,
23+ { baseUrlScheme :: Scheme -- ^ URI scheme to use
16− baseUrlHost :: String,
24+ , baseUrlHost :: String -- ^ host (eg "haskell.org")
17− baseUrlPort :: Int
25+ , baseUrlPort :: Int -- ^ port (eg 80)
18− }
19− deriving (Show, Eq, Ord, Generic)
26+ } deriving (Show, Eq, Ord, Generic)
20
27
21showBaseUrl :: BaseUrl -> String
28showBaseUrl :: BaseUrl -> String
22showBaseUrl (BaseUrl urlscheme host port) =
29showBaseUrl (BaseUrl urlscheme host port) =