package cohttp-lwt

  1. Overview
  2. Docs
CoHTTP implementation using the Lwt concurrency library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cohttp-6.1.1.tbz
sha256=6b420c56203b3a0b515964f036bcea0fb9a362876b5791cd7ff50e12366c489c
sha512=839ff6156658ca6d7922e6eed63ebb84dd09c76107790477be55a1ffc4a3800bf49c435147a0ed628f147eaeccff9a8d34565e3787f32c15e187b6e8855f0b93

doc/cohttp-lwt/Cohttp_lwt/Make_client/argument-1-IO/index.html

Parameter Make_client.IO

include Cohttp.S.IO with type 'a t = 'a Lwt.t
type 'a t = 'a Lwt.t

'a t represents a blocking monad state

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= b will pass the result of a to the b function. This is a monadic bind.

val return : 'a -> 'a t

return a will construct a constant IO value.

type ic

ic represents an input channel

type oc

oc represents an output channel

type conn

conn represents the underlying network flow

val refill : ic -> [ `Ok | `Eof ] t
val with_input_buffer : ic -> f:(string -> pos:int -> len:int -> 'a * int) -> 'a
val read_line : ic -> string option t

read_line ic will read a single line terminated by CR or CRLF from the input channel ic. It returns None if EOF or other error condition is reached.

val read : ic -> int -> string t

read ic len will block until a maximum of len characters are read from the input channel ic. It returns an empty string if EOF or some other error condition occurs on the input channel, and can also return fewer than len characters if input buffering is not sufficient to satisfy the request.

val write : oc -> string -> unit t

write oc s will block until the complete s string is written to the output channel oc.

val flush : oc -> unit t

flush oc will return when all previously buffered content from calling write have been written to the output channel oc.

type error
val catch : (unit -> 'a t) -> ('a, error) result t

catch f is f () >|= Result.ok, unless f fails with an IO error, in which case it returns the error.

val pp_error : Format.formatter -> error -> unit