From 192bea70e80808c4ee804ff4fd6a8e1779066109 Mon Sep 17 00:00:00 2001 From: intractable Date: Fri, 20 Oct 2017 15:53:47 -0500 Subject: [PATCH] Remove warnings from Arithmetic example (#34) * Remove warnings from Arithmetic example * Yes, Parnell, the binding isn't needed ;P --- examples/tutorial/ArithmeticClient.hs | 13 +++++++------ examples/tutorial/ArithmeticServer.hs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/tutorial/ArithmeticClient.hs b/examples/tutorial/ArithmeticClient.hs index 9c86928..8b52d7f 100644 --- a/examples/tutorial/ArithmeticClient.hs +++ b/examples/tutorial/ArithmeticClient.hs @@ -1,9 +1,10 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE OverloadedLists #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE OverloadedLists #-} -{-# LANGUAGE GADTs #-} +{-# LANGUAGE RecordWildCards #-} -import Arithmetic -import Network.GRPC.HighLevel.Generated +import Arithmetic +import Network.GRPC.HighLevel.Generated clientConfig :: ClientConfig clientConfig = ClientConfig { clientServerHost = "localhost" @@ -14,7 +15,7 @@ clientConfig = ClientConfig { clientServerHost = "localhost" main :: IO () main = withGRPCClient clientConfig $ \client -> do - (Arithmetic arithmeticAdd arithmeticRunningSum) <- arithmeticClient client + Arithmetic{..} <- arithmeticClient client -- Request for the Add RPC ClientNormalResponse (OneInt x) _meta1 _meta2 _status _details @@ -28,7 +29,7 @@ main = withGRPCClient clientConfig $ \client -> do :: IO [Either GRPCIOError ()] case sequence eithers of Left err -> error ("Error while streaming: " ++ show err) - Right _ -> return () + Right _ -> return () case reply of Just (OneInt y) -> print ("1 + 2 + 3 = " ++ show y) diff --git a/examples/tutorial/ArithmeticServer.hs b/examples/tutorial/ArithmeticServer.hs index 36a233a..47ba2e0 100644 --- a/examples/tutorial/ArithmeticServer.hs +++ b/examples/tutorial/ArithmeticServer.hs @@ -26,7 +26,7 @@ addHandler (ServerNormalRequest _metadata (TwoInts x y)) = do runningSumHandler :: ServerRequest 'ClientStreaming OneInt OneInt -> IO (ServerResponse 'ClientStreaming OneInt) -runningSumHandler req@(ServerReaderRequest metadata recv) = +runningSumHandler (ServerReaderRequest _metadata recv) = loop 0 where loop !i = do msg <- recv