From e26f12355529390b00835e4051d7019335ab066b Mon Sep 17 00:00:00 2001 From: Arash Rouhani Date: Tue, 24 Jan 2017 11:33:14 +0700 Subject: [PATCH 1/2] tutorial: Make "Position" type consistent I think this change was just overlooked in https://github.com/haskell-servant/servant/pull/355 Without this change, running the server from Server.lhs and client from Client.lhs will result in something like decodeError = "Error in $: The key \"x\" was not found --- doc/tutorial/Client.lhs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/tutorial/Client.lhs b/doc/tutorial/Client.lhs index fa825e2c..eedcd85d 100644 --- a/doc/tutorial/Client.lhs +++ b/doc/tutorial/Client.lhs @@ -27,8 +27,8 @@ Also, we need examples for some domain specific data types: ``` haskell data Position = Position - { x :: Int - , y :: Int + { xCoord :: Int + , yCoord :: Int } deriving (Show, Generic) instance FromJSON Position @@ -135,7 +135,7 @@ run = do Here's the output of the above code running against the appropriate server: ``` bash -Position {x = 10, y = 10} +Position {xCoord = 10, yCoord = 10} HelloMessage {msg = "Hello, servant"} Email {from = "great@company.com", to = "alp@foo.com", subject = "Hey Alp, we miss you!", body = "Hi Alp,\n\nSince you've recently turned 26, have you checked out our latest haskell, mathematics products? Give us a visit!"} ``` From a425c3ae4316d1cf0e5a7fe16165077eb3be4777 Mon Sep 17 00:00:00 2001 From: Arash Rouhani Date: Tue, 24 Jan 2017 11:34:55 +0700 Subject: [PATCH 2/2] tutorial: Update type of BaseUrl to real type I got confused to why there was one more argument passed to constructor than the type takes. Turns out the docs were just a bit out of date. --- doc/tutorial/Client.lhs | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/tutorial/Client.lhs b/doc/tutorial/Client.lhs index eedcd85d..42150872 100644 --- a/doc/tutorial/Client.lhs +++ b/doc/tutorial/Client.lhs @@ -107,6 +107,7 @@ data BaseUrl = BaseUrl { baseUrlScheme :: Scheme -- ^ URI scheme to use , baseUrlHost :: String -- ^ host (eg "haskell.org") , baseUrlPort :: Int -- ^ port (eg 80) + , baseUrlPath :: String -- ^ path (eg "/a/b/c") } ```