mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-23 03:29:42 +01:00
Fix build on GHC 8.4 (#63)
* Fix haddock: postfix comments on GADT constructors don't work. See https://github.com/haskell/haddock/issues/43 . * Remove unused dependencies from cabal file.. * Semigroup instances for compatibility with GHC 8.4.
This commit is contained in:
parent
55f51eaa24
commit
9c6b3f63b6
5 changed files with 12 additions and 26 deletions
|
@ -24,14 +24,7 @@ library
|
|||
, stm == 2.4.*
|
||||
, containers ==0.5.*
|
||||
, managed >= 1.0.0 && < 1.1
|
||||
, pipes >=4.1 && <=4.4
|
||||
, transformers
|
||||
, async ==2.1.*
|
||||
, tasty >= 0.11 && <0.12
|
||||
, tasty-hunit >= 0.9 && <0.10
|
||||
, tasty-quickcheck >= 0.8.4 && < 0.9
|
||||
, safe ==0.3.*
|
||||
, vector
|
||||
, sorted-list >=0.1.6.1 && <=0.3
|
||||
|
||||
c-sources:
|
||||
|
@ -87,7 +80,7 @@ test-suite tests
|
|||
, bytestring ==0.10.*
|
||||
, unix
|
||||
, time
|
||||
, async
|
||||
, async ==2.1.*
|
||||
, tasty >= 0.11 && <0.12
|
||||
, tasty-hunit >= 0.9 && <0.10
|
||||
, tasty-quickcheck >= 0.8.4 && < 0.9
|
||||
|
|
|
@ -7,6 +7,7 @@ import Control.Exception (bracket)
|
|||
import Control.Monad
|
||||
|
||||
import Data.ByteString (ByteString, useAsCString)
|
||||
import Data.Semigroup (Semigroup)
|
||||
|
||||
import Foreign.C.String (CString, peekCString)
|
||||
import Foreign.Marshal.Alloc (free)
|
||||
|
@ -30,7 +31,7 @@ import Network.GRPC.Unsafe.Constants
|
|||
{#context prefix = "grpc" #}
|
||||
|
||||
newtype StatusDetails = StatusDetails {unStatusDetails :: ByteString}
|
||||
deriving (Eq, IsString, Monoid, Show)
|
||||
deriving (Eq, IsString, Monoid, Semigroup, Show)
|
||||
|
||||
{#pointer *grpc_completion_queue as CompletionQueue newtype #}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import Data.Function (on)
|
|||
import Data.ByteString (ByteString, useAsCString,
|
||||
useAsCStringLen)
|
||||
import Data.List (sortBy, groupBy)
|
||||
import Data.Semigroup
|
||||
import qualified Data.SortedList as SL
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Ord (comparing)
|
||||
|
@ -35,10 +36,13 @@ newtype MetadataMap = MetadataMap {unMap :: M.Map ByteString (SL.SortedList Byte
|
|||
instance Show MetadataMap where
|
||||
show m = "fromList " ++ show (M.toList (unMap m))
|
||||
|
||||
instance Semigroup MetadataMap where
|
||||
(MetadataMap m1) <> (MetadataMap m2) =
|
||||
MetadataMap $ M.unionWith mappend m1 m2
|
||||
|
||||
instance Monoid MetadataMap where
|
||||
mempty = MetadataMap $ M.empty
|
||||
mappend (MetadataMap m1) (MetadataMap m2) =
|
||||
MetadataMap $ M.unionWith mappend m1 m2
|
||||
mappend = (<>)
|
||||
|
||||
instance IsList MetadataMap where
|
||||
type Item MetadataMap = (ByteString, ByteString)
|
||||
|
|
|
@ -24,24 +24,12 @@ flag with-examples
|
|||
library
|
||||
build-depends:
|
||||
base >=4.8 && <5.0
|
||||
, clock >=0.6.0 && <0.8.0
|
||||
, bytestring ==0.10.*
|
||||
, stm == 2.4.*
|
||||
, containers ==0.5.*
|
||||
, managed >= 1.0.0 && < 1.1
|
||||
, pipes >=4.1 && <=4.4
|
||||
, transformers
|
||||
, proto3-suite
|
||||
, proto3-wire
|
||||
, grpc-haskell-core
|
||||
|
||||
, async ==2.1.*
|
||||
, tasty >= 0.11 && <0.12
|
||||
, tasty-hunit >= 0.9 && <0.10
|
||||
, tasty-quickcheck >= 0.8.4 && < 0.9
|
||||
, safe ==0.3.*
|
||||
, vector
|
||||
, sorted-list >=0.1.6.1 && <=0.3
|
||||
|
||||
exposed-modules:
|
||||
Network.GRPC.HighLevel
|
||||
|
|
|
@ -54,10 +54,10 @@ data ClientError
|
|||
data ClientRequest (streamType :: GRPCMethodType) request response where
|
||||
ClientNormalRequest :: request -> TimeoutSeconds -> MetadataMap -> ClientRequest 'Normal request response
|
||||
ClientWriterRequest :: TimeoutSeconds -> MetadataMap -> (StreamSend request -> IO ()) -> ClientRequest 'ClientStreaming request response
|
||||
-- | The final field will be invoked once, and it should repeatedly
|
||||
-- invoke its final argument (of type @(StreamRecv response)@)
|
||||
-- in order to obtain the streaming response incrementally.
|
||||
ClientReaderRequest :: request -> TimeoutSeconds -> MetadataMap -> (MetadataMap -> StreamRecv response -> IO ()) -> ClientRequest 'ServerStreaming request response
|
||||
-- ^ The final field will be invoked once, and it should repeatedly
|
||||
-- invoke its final argument (of type @(StreamRecv response)@)
|
||||
-- in order to obtain the streaming response incrementally.
|
||||
ClientBiDiRequest :: TimeoutSeconds -> MetadataMap -> (MetadataMap -> StreamRecv response -> StreamSend request -> WritesDone -> IO ()) -> ClientRequest 'BiDiStreaming request response
|
||||
|
||||
data ClientResult (streamType :: GRPCMethodType) response where
|
||||
|
|
Loading…
Reference in a new issue