Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines a type-level language to describe RPC-like microservices independently of the transport and protocol.
Synopsis
- type Service' = Service Symbol Symbol
- data Service serviceName methodName = Service serviceName [ServiceAnnotation] [Method methodName]
- type ServiceAnnotation = Type
- data Package (s :: Symbol)
- type family FindPackageName (anns :: [ServiceAnnotation]) :: Symbol where ...
- data Method methodName = Method methodName [ServiceAnnotation] [Argument] Return
- type family (s :: Service snm mnm) :-->: (m :: mnm) :: Method mnm where ...
- data TypeRef where
- data Argument where
- data Return where
Documentation
data Service serviceName methodName Source #
A service is a set of methods.
Service serviceName [ServiceAnnotation] [Method methodName] |
type ServiceAnnotation = Type Source #
Annotations for services. At this moment, such annotations can be of any type.
data Package (s :: Symbol) Source #
An annotation to define a package name. This is used by some handlers, like gRPC.
type family FindPackageName (anns :: [ServiceAnnotation]) :: Symbol where ... Source #
Find the Package
for a service, to be found
as part of the annotations.
FindPackageName '[] = TypeError (Text "Cannot find package name for the service") | |
FindPackageName (Package s ': rest) = s | |
FindPackageName (other ': rest) = FindPackageName rest |
data Method methodName Source #
A method is defined by its name, arguments, and return type.
Method methodName [ServiceAnnotation] [Argument] Return |
type family (s :: Service snm mnm) :-->: (m :: mnm) :: Method mnm where ... Source #
Look up a method in a service definition using its name.
Useful to declare handlers like HandlerIO (MyService :-->: MyMethod)
.
Defines how to handle the type
Defines the way in which arguments are handled.
Defines the different possibilities for returning information from a method.