mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-26 21:19:43 +01:00
Remove warnings from Arithmetic example (#34)
* Remove warnings from Arithmetic example * Yes, Parnell, the binding isn't needed ;P
This commit is contained in:
parent
0ff7b36610
commit
192bea70e8
2 changed files with 8 additions and 7 deletions
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue