on master help sign in
Better docs for EmptyAPIClient
178f055David Turner
servant-client/src/Servant/Client.hs+11−1
@@ -89,9 +89,19 @@ instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
89 clientWithRoute (Proxy :: Proxy a) req :<|>
89 clientWithRoute (Proxy :: Proxy a) req :<|>
90 clientWithRoute (Proxy :: Proxy b) req
90 clientWithRoute (Proxy :: Proxy b) req
91
91
92−-- | TODO docs
92+-- | Singleton type representing a client for an empty API.
93data EmptyAPIClient = EmptyAPIClient
93data EmptyAPIClient = EmptyAPIClient
94
94
95+-- | The client for 'EmptyAPI' is simply 'EmptyAPIClient'.
96+--
97+-- > type MyAPI = "books" :> Get '[JSON] [Book] -- GET /books
98+-- > :<|> "nothing" :> EmptyAPI
99+-- >
100+-- > myApi :: Proxy MyApi
101+-- > myApi = Proxy
102+-- >
103+-- > getAllBooks :: ClientM [Book]
104+-- > (getAllBooks :<|> EmptyAPIClient) = client myApi
95instance HasClient EmptyAPI where
105instance HasClient EmptyAPI where
96 type Client EmptyAPI = EmptyAPIClient
106 type Client EmptyAPI = EmptyAPIClient
97 clientWithRoute Proxy _ = EmptyAPIClient
107 clientWithRoute Proxy _ = EmptyAPIClient