@@ -206,10 +206,9 @@ module type S = sig
206206 Endpoints allow users to create flows by either connecting directly to a
207207 remote server or by resolving domain names (with {!connect}). *)
208208
209- val register : protocol :('edn , 'flow ) impl -> ('edn , 'flow ) protocol
210- (* * [register ~protocol] is the protocol using the implementation [protocol].
211- [protocol] must provide a [connect] function to allow client flows to be
212- created.
209+ val register : ('edn , 'flow ) impl -> ('edn , 'flow ) protocol
210+ (* * [register i] is the protocol using the implementation [i]. [protocol] must
211+ provide a [connect] function to allow client flows to be created.
213212
214213 For instance, on Unix, [Conduit] clients will use [Unix.sockaddr] as flow
215214 endpoints, while [Unix.file_descr] would be used for the flow transport.
@@ -218,7 +217,7 @@ module type S = sig
218217 module Conduit_tcp : sig
219218 val t : (Unix.sockaddr, Unix.file_descr) protocol
220219 end = struct
221- let t = register ~protocol: (module TCP)
220+ let t = register (module TCP)
222221 end
223222 ]}
224223
@@ -230,7 +229,7 @@ module type S = sig
230229 module Conduit_tcp_tls : sig
231230 val t : (Unix.sockaddr * Tls.Config.client, Unix.file_descr) protocol
232231 end = struct
233- let t = register ~protocol: (module TLS)
232+ let t = register (module TLS)
234233 end
235234 ]}
236235
@@ -281,7 +280,7 @@ module type S = sig
281280
282281 val t : (Unix.sockaddr, Unix.file_descr) protocol
283282 end = struct
284- let t = register ~protocol: (module TCP)
283+ let t = register (module TCP)
285284
286285 include (val Conduit.repr t)
287286 end
@@ -430,34 +429,30 @@ module type S = sig
430429 and type t = 't
431430 and type flow = 'flow )
432431
433- type ('cfg, 't, 'flow) service
432+ type ('cfg, 't, 'flow) t
434433 (* * The type for services, e.g. service-side protocols. ['cfg] is the type
435- for configuration, ['t ] is the type for state states. ['flow] is the
434+ for configuration, ['s ] is the type for server states. ['flow] is the
436435 type for underlying flows. *)
437436
438437 val equal :
439- ('cfg0 , 't0 , 'flow0 ) service ->
440- ('cfg1 , 't1 , 'flow1 ) service ->
438+ ('cfg0 , 't0 , 'flow0 ) t ->
439+ ('cfg1 , 't1 , 'flow1 ) t ->
441440 (('cfg0 , 'cfg1 ) refl * ('t0 , 't1 ) refl * ('flow0 , 'flow1 ) refl ) option
442441 (* * [equal svc0 svc1] proves that [svc0] and [svc1] are physically the same.
443442 For instance, [Conduit] asserts:
444443
445444 {[
446- let service = Service.register ~service: (module V) ;;
445+ let service = Service.register (module V) protocol ;;
447446
448447 let () = match Service.equal service service with
449448 | Some (Refl, Refl, Refl) -> ...
450449 | _ -> assert false
451450 ]} *)
452451
453- val register :
454- service :('cfg , 't , 'v ) impl ->
455- protocol :(_ , 'v ) protocol ->
456- ('cfg , 't , 'v ) service
457- (* * [register ~service ~protocool] is the service using the implementation
458- [service] bound with implementation of a [protocol]. [service] must
459- define [make] and [accept] function to be able to create server-side
460- flows.
452+ val register : ('cfg , 't , 'v ) impl -> (_ , 'v ) protocol -> ('cfg , 't , 'v ) t
453+ (* * [register i p] is the service using the implementation [i] using the
454+ protocol [p]. [i] should define a [make] and an [accept] function to
455+ create server-side flows.
461456
462457 For instance:
463458
@@ -466,30 +461,26 @@ module type S = sig
466461 and type t = Unix.file_descr
467462 and type flow = Unix.file_descr
468463
469- let tcp_protocol = Conduit.register ~protocol: (module TCP_protocol)
464+ let tcp_protocol = Conduit.register (module TCP_protocol)
470465 let tcp_service : (Unix.sockaddr, Unix.file_descr, Unix.file_descr) Service.service =
471- Conduit.Service.register ~service: (module TCP_service) ~protocol: tcp_protocol
466+ Conduit.Service.register (module TCP_service) tcp_protocol
472467 ]} *)
473468
474469 type error = [ `Msg of string ]
475470
476471 val pp_error : error Fmt .t
477472
478- val init :
479- 'cfg -> service :('cfg , 't , 'v ) service -> ('t , [> error ]) result io
480- (* * [init cfg ~service] initialises the service with the configuration
481- [cfg]. *)
473+ val init : ('cfg , 't , 'v ) t -> 'cfg -> ('t , [> error ]) result io
474+ (* * [init t cfg] initialises the service with the configuration [cfg]. *)
482475
483- val accept :
484- service :('cfg , 't , 'v ) service -> 't -> (flow , [> error ]) result io
485- (* * [accept service t] waits for a connection on the service [t]. The result
486- is a {i flow} connected to the client. *)
476+ val accept : ('cfg , 's , 'v ) t -> 's -> (flow , [> error ]) result io
477+ (* * [accept t s] waits for a connection on the server [s]. The result is a
478+ {i flow} connected to the client. *)
487479
488- val close :
489- service :('cfg , 't , 'v ) service -> 't -> (unit , [> error ]) result io
490- (* * [close ~service t] releases the resources associated to the server [t]. *)
480+ val close : ('cfg , 's , 'v ) t -> 's -> (unit , [> error ]) result io
481+ (* * [close t s] releases the resources associated to the server [s]. *)
491482
492- val pack : (_ , _ , 'v ) service -> 'v -> flow
483+ val pack : (_ , _ , 'v ) t -> 'v -> flow
493484 (* * [pack service v] returns the abstracted value [v] as {!pack} does for a
494485 given protocol {i witness} (bound with the given [service]). It serves
495486 to abstract the flow created (and initialised) by the service to a
@@ -500,7 +491,7 @@ module type S = sig
500491 Conduit.send flow "Hello World!" >>= fun _ ->
501492 ...
502493
503- let run ~ service cfg =
494+ let run service cfg =
504495 let module Service = Conduit.Service.impl service in
505496 Service.init cfg >>? fun t ->
506497 let rec loop t =
@@ -509,12 +500,12 @@ module type S = sig
509500 async (fun () -> handler flow) ; loop t in
510501 loop t
511502
512- let () = run ~service: tcp_service (localhost, 8080)
513- let () = run ~service: tls_service (certs, (localhost, 8080))
503+ let () = run tcp_service (localhost, 8080)
504+ let () = run tls_service (certs, (localhost, 8080))
514505 ]} *)
515506
516507 val impl :
517- ('cfg , 't , 'v ) service ->
508+ ('cfg , 't , 'v ) t ->
518509 (module SERVICE
519510 with type configuration = 'cfg
520511 and type t = 't
0 commit comments