Travis/service generation (#46)

* higher bound on clock versions

* Added helper module for generated service code
This commit is contained in:
Connor Clark 2016-07-20 11:26:53 -07:00
parent 65026eb79c
commit cc5d30acd2
2 changed files with 24 additions and 1 deletions

View File

@ -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.*

View 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