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:
Ewout 2018-06-18 21:24:19 +02:00 committed by Gabriel Gonzalez
parent 55f51eaa24
commit 9c6b3f63b6
5 changed files with 12 additions and 26 deletions

View File

@ -24,14 +24,7 @@ library
, stm == 2.4.* , stm == 2.4.*
, containers ==0.5.* , containers ==0.5.*
, managed >= 1.0.0 && < 1.1 , managed >= 1.0.0 && < 1.1
, pipes >=4.1 && <=4.4
, transformers , 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 , sorted-list >=0.1.6.1 && <=0.3
c-sources: c-sources:
@ -87,7 +80,7 @@ test-suite tests
, bytestring ==0.10.* , bytestring ==0.10.*
, unix , unix
, time , time
, async , 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
, tasty-quickcheck >= 0.8.4 && < 0.9 , tasty-quickcheck >= 0.8.4 && < 0.9

View File

@ -7,6 +7,7 @@ import Control.Exception (bracket)
import Control.Monad import Control.Monad
import Data.ByteString (ByteString, useAsCString) import Data.ByteString (ByteString, useAsCString)
import Data.Semigroup (Semigroup)
import Foreign.C.String (CString, peekCString) import Foreign.C.String (CString, peekCString)
import Foreign.Marshal.Alloc (free) import Foreign.Marshal.Alloc (free)
@ -30,7 +31,7 @@ import Network.GRPC.Unsafe.Constants
{#context prefix = "grpc" #} {#context prefix = "grpc" #}
newtype StatusDetails = StatusDetails {unStatusDetails :: ByteString} newtype StatusDetails = StatusDetails {unStatusDetails :: ByteString}
deriving (Eq, IsString, Monoid, Show) deriving (Eq, IsString, Monoid, Semigroup, Show)
{#pointer *grpc_completion_queue as CompletionQueue newtype #} {#pointer *grpc_completion_queue as CompletionQueue newtype #}

View File

@ -12,6 +12,7 @@ import Data.Function (on)
import Data.ByteString (ByteString, useAsCString, import Data.ByteString (ByteString, useAsCString,
useAsCStringLen) useAsCStringLen)
import Data.List (sortBy, groupBy) import Data.List (sortBy, groupBy)
import Data.Semigroup
import qualified Data.SortedList as SL import qualified Data.SortedList as SL
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Data.Ord (comparing) import Data.Ord (comparing)
@ -35,10 +36,13 @@ newtype MetadataMap = MetadataMap {unMap :: M.Map ByteString (SL.SortedList Byte
instance Show MetadataMap where instance Show MetadataMap where
show m = "fromList " ++ show (M.toList (unMap m)) 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 instance Monoid MetadataMap where
mempty = MetadataMap $ M.empty mempty = MetadataMap $ M.empty
mappend (MetadataMap m1) (MetadataMap m2) = mappend = (<>)
MetadataMap $ M.unionWith mappend m1 m2
instance IsList MetadataMap where instance IsList MetadataMap where
type Item MetadataMap = (ByteString, ByteString) type Item MetadataMap = (ByteString, ByteString)

View File

@ -24,24 +24,12 @@ flag with-examples
library library
build-depends: build-depends:
base >=4.8 && <5.0 base >=4.8 && <5.0
, clock >=0.6.0 && <0.8.0
, bytestring ==0.10.* , bytestring ==0.10.*
, stm == 2.4.*
, containers ==0.5.*
, managed >= 1.0.0 && < 1.1
, pipes >=4.1 && <=4.4
, transformers
, proto3-suite , proto3-suite
, proto3-wire , proto3-wire
, grpc-haskell-core , grpc-haskell-core
, async ==2.1.* , 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: exposed-modules:
Network.GRPC.HighLevel Network.GRPC.HighLevel

View File

@ -54,10 +54,10 @@ data ClientError
data ClientRequest (streamType :: GRPCMethodType) request response where data ClientRequest (streamType :: GRPCMethodType) request response where
ClientNormalRequest :: request -> TimeoutSeconds -> MetadataMap -> ClientRequest 'Normal request response ClientNormalRequest :: request -> TimeoutSeconds -> MetadataMap -> ClientRequest 'Normal request response
ClientWriterRequest :: TimeoutSeconds -> MetadataMap -> (StreamSend request -> IO ()) -> ClientRequest 'ClientStreaming 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 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 ClientBiDiRequest :: TimeoutSeconds -> MetadataMap -> (MetadataMap -> StreamRecv response -> StreamSend request -> WritesDone -> IO ()) -> ClientRequest 'BiDiStreaming request response
data ClientResult (streamType :: GRPCMethodType) response where data ClientResult (streamType :: GRPCMethodType) response where