Remove proto3-wire dependency from core package. (#47)

This commit is contained in:
Christian Lavoie 2018-01-30 12:20:05 -05:00 committed by Gabriel Gonzalez
parent 9cfb3da770
commit 5fd44880da
4 changed files with 5 additions and 9 deletions

View file

@ -28,7 +28,7 @@ used to give you a development environment where you can use the `cabal` and
`stack` toolchains for development and testing: `stack` toolchains for development and testing:
```bash ```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 [nix-shell]$ cabal configure --enable-tests && cabal build && cabal test
``` ```

View file

@ -26,9 +26,6 @@ library
, managed >= 1.0.0 && < 1.1 , managed >= 1.0.0 && < 1.1
, pipes >=4.1 && <=4.4 , pipes >=4.1 && <=4.4
, transformers , transformers
, proto3-suite
, proto3-wire
, async ==2.1.* , async ==2.1.*
, tasty >= 0.11 && <0.12 , tasty >= 0.11 && <0.12
, tasty-hunit >= 0.9 && <0.10 , tasty-hunit >= 0.9 && <0.10

View file

@ -21,7 +21,6 @@ import Data.Typeable
import qualified Network.GRPC.Unsafe as C import qualified Network.GRPC.Unsafe as C
import qualified Network.GRPC.Unsafe.Op as C import qualified Network.GRPC.Unsafe.Op as C
import qualified Network.GRPC.Unsafe.Metadata 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 -- | 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 -- must be initialized to create any gRPC state, so this is a requirement for
@ -50,7 +49,7 @@ data GRPCIOError = GRPCIOCallError C.CallError
| GRPCIOUnknownError | GRPCIOUnknownError
| GRPCIOBadStatusCode C.StatusCode C.StatusDetails | GRPCIOBadStatusCode C.StatusCode C.StatusDetails
| GRPCIODecodeError ParseError | GRPCIODecodeError String
| GRPCIOInternalUnexpectedRecv String -- debugging description | GRPCIOInternalUnexpectedRecv String -- debugging description
| GRPCIOHandlerException String | GRPCIOHandlerException String
deriving (Eq, Show, Typeable) deriving (Eq, Show, Typeable)

View file

@ -53,7 +53,7 @@ convertServerHandler :: (Message a, Message b)
=> ServerHandler a b => ServerHandler a b
-> ServerHandlerLL -> ServerHandlerLL
convertServerHandler f c = case fromByteString (payload c) of 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) Right x -> do (y, tm, sc, sd) <- f (fmap (const x) c)
return (toBS y, tm, sc, sd) return (toBS y, tm, sc, sd)
@ -99,7 +99,7 @@ convertServerWriterHandler f c send =
f (convert <$> c) (convertSend send) f (convert <$> c) (convertSend send)
where where
convert bs = case fromByteString bs of convert bs = case fromByteString bs of
Left x -> CE.throw (GRPCIODecodeError x) Left x -> CE.throw (GRPCIODecodeError $ show x)
Right x -> x Right x -> x
type ServerRWHandler a b type ServerRWHandler a b
@ -129,7 +129,7 @@ convertRecv =
case msg of case msg of
Nothing -> return Nothing Nothing -> return Nothing
Just bs -> case fromByteString bs of Just bs -> case fromByteString bs of
Left x -> Left (GRPCIODecodeError x) Left x -> Left (GRPCIODecodeError $ show x)
Right x -> return (Just x) Right x -> return (Just x)
convertSend :: Message a => StreamSend ByteString -> StreamSend a convertSend :: Message a => StreamSend ByteString -> StreamSend a