From 5fd44880da343343a7a25ff0bc42e07c044432f7 Mon Sep 17 00:00:00 2001 From: Christian Lavoie <32549826+clavoie-takt@users.noreply.github.com> Date: Tue, 30 Jan 2018 12:20:05 -0500 Subject: [PATCH] Remove `proto3-wire` dependency from `core` package. (#47) --- README.md | 2 +- core/grpc-haskell-core.cabal | 3 --- core/src/Network/GRPC/LowLevel/GRPC.hs | 3 +-- src/Network/GRPC/HighLevel/Server.hs | 6 +++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ff0239f..90f51ff 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ used to give you a development environment where you can use the `cabal` and `stack` toolchains for development and testing: ```bash -$ nix-shell release-nix -A grpc-haskell.env +$ nix-shell release.nix -A grpc-haskell.env [nix-shell]$ cabal configure --enable-tests && cabal build && cabal test ``` diff --git a/core/grpc-haskell-core.cabal b/core/grpc-haskell-core.cabal index 71d19f6..7eaf5e3 100644 --- a/core/grpc-haskell-core.cabal +++ b/core/grpc-haskell-core.cabal @@ -26,9 +26,6 @@ library , managed >= 1.0.0 && < 1.1 , pipes >=4.1 && <=4.4 , transformers - , proto3-suite - , proto3-wire - , async ==2.1.* , tasty >= 0.11 && <0.12 , tasty-hunit >= 0.9 && <0.10 diff --git a/core/src/Network/GRPC/LowLevel/GRPC.hs b/core/src/Network/GRPC/LowLevel/GRPC.hs index ba2bd22..397665d 100644 --- a/core/src/Network/GRPC/LowLevel/GRPC.hs +++ b/core/src/Network/GRPC/LowLevel/GRPC.hs @@ -21,7 +21,6 @@ import Data.Typeable import qualified Network.GRPC.Unsafe as C import qualified Network.GRPC.Unsafe.Op as C import qualified Network.GRPC.Unsafe.Metadata as C -import Proto3.Wire.Decode (ParseError) -- | Functions as a proof that the gRPC core has been started. The gRPC core -- must be initialized to create any gRPC state, so this is a requirement for @@ -50,7 +49,7 @@ data GRPCIOError = GRPCIOCallError C.CallError | GRPCIOUnknownError | GRPCIOBadStatusCode C.StatusCode C.StatusDetails - | GRPCIODecodeError ParseError + | GRPCIODecodeError String | GRPCIOInternalUnexpectedRecv String -- debugging description | GRPCIOHandlerException String deriving (Eq, Show, Typeable) diff --git a/src/Network/GRPC/HighLevel/Server.hs b/src/Network/GRPC/HighLevel/Server.hs index 5d7d0cc..572965b 100644 --- a/src/Network/GRPC/HighLevel/Server.hs +++ b/src/Network/GRPC/HighLevel/Server.hs @@ -53,7 +53,7 @@ convertServerHandler :: (Message a, Message b) => ServerHandler a b -> ServerHandlerLL convertServerHandler f c = case fromByteString (payload c) of - Left x -> CE.throw (GRPCIODecodeError x) + Left x -> CE.throw (GRPCIODecodeError $ show x) Right x -> do (y, tm, sc, sd) <- f (fmap (const x) c) return (toBS y, tm, sc, sd) @@ -99,7 +99,7 @@ convertServerWriterHandler f c send = f (convert <$> c) (convertSend send) where convert bs = case fromByteString bs of - Left x -> CE.throw (GRPCIODecodeError x) + Left x -> CE.throw (GRPCIODecodeError $ show x) Right x -> x type ServerRWHandler a b @@ -129,7 +129,7 @@ convertRecv = case msg of Nothing -> return Nothing Just bs -> case fromByteString bs of - Left x -> Left (GRPCIODecodeError x) + Left x -> Left (GRPCIODecodeError $ show x) Right x -> return (Just x) convertSend :: Message a => StreamSend ByteString -> StreamSend a