Remove warnings from Arithmetic example (#34)

* Remove warnings from Arithmetic example

* Yes, Parnell, the binding isn't needed ;P
This commit is contained in:
intractable 2017-10-20 15:53:47 -05:00 committed by GitHub
parent 0ff7b36610
commit 192bea70e8
2 changed files with 8 additions and 7 deletions

View file

@ -1,9 +1,10 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE GADTs #-}
import Arithmetic import Arithmetic
import Network.GRPC.HighLevel.Generated import Network.GRPC.HighLevel.Generated
clientConfig :: ClientConfig clientConfig :: ClientConfig
clientConfig = ClientConfig { clientServerHost = "localhost" clientConfig = ClientConfig { clientServerHost = "localhost"
@ -14,7 +15,7 @@ clientConfig = ClientConfig { clientServerHost = "localhost"
main :: IO () main :: IO ()
main = withGRPCClient clientConfig $ \client -> do main = withGRPCClient clientConfig $ \client -> do
(Arithmetic arithmeticAdd arithmeticRunningSum) <- arithmeticClient client Arithmetic{..} <- arithmeticClient client
-- Request for the Add RPC -- Request for the Add RPC
ClientNormalResponse (OneInt x) _meta1 _meta2 _status _details ClientNormalResponse (OneInt x) _meta1 _meta2 _status _details
@ -28,7 +29,7 @@ main = withGRPCClient clientConfig $ \client -> do
:: IO [Either GRPCIOError ()] :: IO [Either GRPCIOError ()]
case sequence eithers of case sequence eithers of
Left err -> error ("Error while streaming: " ++ show err) Left err -> error ("Error while streaming: " ++ show err)
Right _ -> return () Right _ -> return ()
case reply of case reply of
Just (OneInt y) -> print ("1 + 2 + 3 = " ++ show y) Just (OneInt y) -> print ("1 + 2 + 3 = " ++ show y)

View file

@ -26,7 +26,7 @@ addHandler (ServerNormalRequest _metadata (TwoInts x y)) = do
runningSumHandler :: ServerRequest 'ClientStreaming OneInt OneInt runningSumHandler :: ServerRequest 'ClientStreaming OneInt OneInt
-> IO (ServerResponse 'ClientStreaming OneInt) -> IO (ServerResponse 'ClientStreaming OneInt)
runningSumHandler req@(ServerReaderRequest metadata recv) = runningSumHandler (ServerReaderRequest _metadata recv) =
loop 0 loop 0
where loop !i = where loop !i =
do msg <- recv do msg <- recv