| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.ProtoLens.Service.Types
Description
This module provides typeclasses for describing protobuf service metadata. It is intended to be used by library authors to generating bindings against proto services for specific RPC backends.
Synopsis
- class (KnownSymbol (ServiceName s), KnownSymbol (ServicePackage s), HasAllMethods s (ServiceMethods s)) => Service s where
- type ServiceName s :: Symbol
- type ServicePackage s :: Symbol
- type ServiceMethods s :: [Symbol]
- class HasAllMethods s (ms :: [Symbol])
- class (KnownSymbol m, KnownSymbol (MethodName s m), Service s, Message (MethodInput s m), Message (MethodOutput s m)) => HasMethodImpl s (m :: Symbol) where
- type MethodName s m :: Symbol
- type MethodInput s m :: *
- type MethodOutput s m :: *
- type MethodStreamingType s m :: StreamingType
- type HasMethod s m = (RequireHasMethod s m (ListContains m (ServiceMethods s)), HasMethodImpl s m)
- data StreamingType
Documentation
class (KnownSymbol (ServiceName s), KnownSymbol (ServicePackage s), HasAllMethods s (ServiceMethods s)) => Service s Source #
Metadata describing a protobuf service. The s parameter is a phantom
type generated by proto-lens.
The ServiceName and ServicePackage associated type can be used to
generate RPC endpoint paths.
ServiceMethods is a promoted list containing every method defined on the
service. As witnessed by the HasAllMethods superclass constraint here,
this type can be used to discover every instance of HasMethod available
for the service.
Associated Types
type ServiceName s :: Symbol Source #
type ServicePackage s :: Symbol Source #
type ServiceMethods s :: [Symbol] Source #
class HasAllMethods s (ms :: [Symbol]) Source #
Reifies the fact that there is a HasMethod instance for every symbol
claimed by the ServiceMethods associated type.
Instances
| HasAllMethods (s :: k) ([] :: [Symbol]) Source # | |
Defined in Data.ProtoLens.Service.Types | |
| (HasAllMethods s ms, HasMethodImpl s m) => HasAllMethods (s :: k) (m ': ms) Source # | |
Defined in Data.ProtoLens.Service.Types | |
class (KnownSymbol m, KnownSymbol (MethodName s m), Service s, Message (MethodInput s m), Message (MethodOutput s m)) => HasMethodImpl s (m :: Symbol) Source #
Metadata describing a service method. The MethodInput and MethodOutput
type families correspond to the Messages generated by proto-lens for the
RPC as described in the protobuf.
IsClientStreaming and IsServerStreaming can be used to dispatch on
library code which wishes to provide different interfaces depending on the
type of streaming of the method.
Library code should use HasMethod instead of this class directly whenever
the constraint will be exposed to the end user. HasMethod provides
substantially friendlier error messages when used incorrectly.
Associated Types
type MethodName s m :: Symbol Source #
type MethodInput s m :: * Source #
type MethodOutput s m :: * Source #
type MethodStreamingType s m :: StreamingType Source #
type HasMethod s m = (RequireHasMethod s m (ListContains m (ServiceMethods s)), HasMethodImpl s m) Source #
Helper constraint that expands to a user-friendly error message when m
isn't actually a method provided by service s.
data StreamingType Source #
Data type to be used as a promoted type for MethodStreamingType.
Constructors
| NonStreaming | |
| ClientStreaming | |
| ServerStreaming | |
| BiDiStreaming |