Legend:
Library
Module
Module type
Parameter
Class
Class type
This module generates a server that dispatches RPC calls to their implementations.
Given an Rpc.call, it calls the implementation of that RPC method and performs the marshalling and unmarshalling. It is up to the user of this library to connect this rpc function to a real server that responds to client requests.
The implementations of each RPC method should be specified by passing it to the corresponding function in the generated module.
Then the server itself can be obtained by passing the implementation to server.
The implementation is dependent on the module, and represents the 'result' of the entire module. For example, in the Server module, the `implementation` is the server function, with type
Rpc.call -> Rpc.response.
For the Client module, the individual declarations are used to perform the RPCs, and the 'implementation' type is simply unit.
To actually construct the implementation, an interface description must be provided
type'a res = 'a-> unit
'a res is the result type of declaring a function. For example, the Client module, given an (int -> int -> int) fn, will return a function of type 'a - in this case, (int -> int -> int)
type('a, 'b) comp = ('a, 'b)Result.result
This is for inserting a type in between the function application and its result. For example, this could be an Lwt.t, meaning that the result of a function application is a thread
declare name description typ is how an RPC is declared to the module implementing the functionality. The return type is dependent upon the module being used