mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-23 03:29:42 +01:00
Travis/service generation (#46)
* higher bound on clock versions * Added helper module for generated service code
This commit is contained in:
parent
65026eb79c
commit
cc5d30acd2
2 changed files with 24 additions and 1 deletions
|
@ -26,7 +26,7 @@ flag with-examples
|
|||
library
|
||||
build-depends:
|
||||
base ==4.8.*
|
||||
, clock ==0.6.*
|
||||
, clock >=0.6.0 && <=0.7.2
|
||||
, bytestring ==0.10.*
|
||||
, stm == 2.4.*
|
||||
, containers ==0.5.*
|
||||
|
|
23
src/Network/GRPC/HighLevel/Generated.hs
Normal file
23
src/Network/GRPC/HighLevel/Generated.hs
Normal file
|
@ -0,0 +1,23 @@
|
|||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
|
||||
module Network.GRPC.HighLevel.Generated where
|
||||
|
||||
import Network.GRPC.HighLevel.Server
|
||||
import Network.GRPC.LowLevel.Call
|
||||
|
||||
-- | Used at the kind level as a parameter to service definitions
|
||||
-- generated by the grpc compiler, with the effect of having the
|
||||
-- field types reduce to the appropriate types for the method types.
|
||||
data GRPCImpl = ServerImpl | ClientImpl
|
||||
|
||||
-- | GHC does not let us partially apply a type family. However, we
|
||||
-- can define a type to use as an 'interpreter', and then use this
|
||||
-- 'interpreter' type fully applied to get the same effect.
|
||||
type family MkHandler (impl :: GRPCImpl) (methodType :: GRPCMethodType) i o
|
||||
|
||||
type instance MkHandler 'ServerImpl 'Normal i o = ServerHandler i o
|
||||
type instance MkHandler 'ServerImpl 'ClientStreaming i o = ServerReaderHandler i o
|
||||
type instance MkHandler 'ServerImpl 'ServerStreaming i o = ServerWriterHandler i o
|
||||
type instance MkHandler 'ServerImpl 'BiDiStreaming i o = ServerRWHandler i o
|
Loading…
Reference in a new issue