Documentation fixes
This commit is contained in:
parent
d6aee29be1
commit
da8337809b
6 changed files with 18 additions and 16 deletions
|
@ -128,15 +128,15 @@ That's it. Let's now write some code that uses our client functions.
|
|||
``` haskell
|
||||
queries :: ClientM (Position, HelloMessage, Email)
|
||||
queries = do
|
||||
pos <- position 10 10
|
||||
message <- hello (Just "servant")
|
||||
pos <- position 10 10
|
||||
message <- hello (Just "servant")
|
||||
em <- marketing (ClientInfo "Alp" "alp@foo.com" 26 ["haskell", "mathematics"])
|
||||
return (pos, message, em)
|
||||
|
||||
run :: IO ()
|
||||
run = do
|
||||
manager <- newManager defaultManagerSettings
|
||||
res <- runClientM queries (ClientEnv manager (BaseUrl Http "localhost" 8081 ""))
|
||||
manager' <- newManager defaultManagerSettings
|
||||
res <- runClientM queries (ClientEnv manager' (BaseUrl Http "localhost" 8081 ""))
|
||||
case res of
|
||||
Left err -> putStrLn $ "Error: " ++ show err
|
||||
Right (pos, message, em) -> do
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Revision history for servant-client-core
|
||||
|
||||
## 0.11 -- YYYY-mm-dd
|
||||
## 0.12 -- YYYY-mm-dd
|
||||
|
||||
* First version. Released on an unsuspecting world.
|
||||
* First version. Factored out of servant-client all the functionality that was
|
||||
independent of the http-client backend.
|
||||
|
|
|
@ -10,7 +10,7 @@ This library should mainly be of interest to backend- and combinator-writers.
|
|||
|
||||
If you are creating a new backend, you'll need to:
|
||||
|
||||
1. Define a `RunClient` instance for your datatype (call it 'MyMonad')
|
||||
1. Define a `RunClient` instance for your datatype (call it `MyMonad`)
|
||||
2. Define a `ClientLike` instance. This will look like:
|
||||
|
||||
``` haskell
|
||||
|
|
|
@ -51,14 +51,15 @@ library
|
|||
, text >= 1.2 && < 1.3
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
include-dirs: include
|
||||
ghc-options: -Wall
|
||||
include-dirs: include
|
||||
|
||||
test-suite spec
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -Wall
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -Wall
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
build-depends:
|
||||
base
|
||||
, base-compat
|
||||
|
|
|
@ -6,8 +6,8 @@ module Servant.Client
|
|||
, ClientM
|
||||
, runClientM
|
||||
, ClientEnv(..)
|
||||
, module X
|
||||
, module Servant.Client.Core.Reexport
|
||||
) where
|
||||
|
||||
import Servant.Client.Internal.HttpClient
|
||||
import Servant.Client.Core.Reexport as X
|
||||
import Servant.Client.Core.Reexport
|
||||
|
|
|
@ -65,7 +65,7 @@ client :: HasClient ClientM api => Proxy api -> Client ClientM api
|
|||
client api = api `clientIn` (Proxy :: Proxy ClientM)
|
||||
|
||||
-- | @ClientM@ is the monad in which client functions run. Contains the
|
||||
-- 'Manager' and 'BaseUrl' used for requests in the reader environment.
|
||||
-- 'Client.Manager' and 'BaseUrl' used for requests in the reader environment.
|
||||
newtype ClientM a = ClientM
|
||||
{ runClientM' :: ReaderT ClientEnv (ExceptT ServantError IO) a }
|
||||
deriving ( Functor, Applicative, Monad, MonadIO, Generic
|
||||
|
|
Loading…
Reference in a new issue