proto-lens-0.7.1.3: A lens-based implementation of protocol buffers in Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

class (KnownSymbol (ServiceName s), KnownSymbol (ServicePackage s), HasAllMethods s (ServiceMethods s)) => Service s where 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

Instances details
HasAllMethods (s :: k) ('[] :: [Symbol]) Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

(HasAllMethods s ms, HasMethodImpl s m) => HasAllMethods (s :: k) (m ': ms) Source # 
Instance details

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 :: Type Source #

type MethodOutput s m :: Type 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.

Instances

Instances details
Bounded StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

Enum StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

Read StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

Show StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

Eq StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types

Ord StreamingType Source # 
Instance details

Defined in Data.ProtoLens.Service.Types