diff --git a/src/baselib/ocsigen_cache.ml b/src/baselib/ocsigen_cache.ml index 2aedf39c4..801edd13d 100644 --- a/src/baselib/ocsigen_cache.ml +++ b/src/baselib/ocsigen_cache.ml @@ -22,7 +22,7 @@ @author Raphaƫl Proust (adding timers) *) -let ( >>= ) = Lwt.bind +open Lwt.Infix module Dlist : sig type 'a t @@ -66,12 +66,6 @@ module Dlist : sig (** fold over the elements from the cache starting from the oldest to the newest *) - val lwt_fold : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t - (** lwt version of fold *) - - val lwt_fold_back : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t - (** lwt version of fold_back *) - val move : 'a node -> 'a t -> 'a option (** Move a node from one dlist to another one, without finalizing. If one value is removed from the destination list (because its @@ -322,34 +316,6 @@ end = struct (match node.mylist with None -> () | Some l -> remove' node l); match add_node node l with None -> None | Some v -> remove v; Some v.value - (* fold over the elements from the newest to the oldest *) - let lwt_fold f accu {newest; _} = - match newest with - | None -> Lwt.return accu - | Some newest -> - let rec fold accu node = - f accu node.value >>= fun accu -> - match node.prev with - | None -> Lwt.return accu - | Some new_node when new_node == newest -> Lwt.return accu - | Some new_node -> fold accu new_node - in - fold accu newest - - (* fold over the elements from the oldest to the newest *) - let lwt_fold_back f accu {oldest; _} = - match oldest with - | None -> Lwt.return accu - | Some oldest -> - let rec fold accu node = - f accu node.value >>= fun accu -> - match node.succ with - | None -> Lwt.return accu - | Some new_node when new_node == oldest -> Lwt.return accu - | Some new_node -> fold accu new_node - in - fold accu oldest - (* fold over the elements from the newest to the oldest *) let fold f accu {newest; _} = match newest with diff --git a/src/baselib/ocsigen_cache.mli b/src/baselib/ocsigen_cache.mli index 24c18dd75..fc68c2fe4 100644 --- a/src/baselib/ocsigen_cache.mli +++ b/src/baselib/ocsigen_cache.mli @@ -125,12 +125,6 @@ module Dlist : sig (** fold over the elements from the cache starting from the oldest to the newest *) - val lwt_fold : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t - (** lwt version of fold *) - - val lwt_fold_back : ('b -> 'a -> 'b Lwt.t) -> 'b -> 'a t -> 'b Lwt.t - (** lwt version of fold_back *) - val move : 'a node -> 'a t -> 'a option (** Move a node from one dlist to another one, without finalizing. If one value is removed from the destination list (because its diff --git a/src/baselib/ocsigen_lib_base.ml b/src/baselib/ocsigen_lib_base.ml index e62cab28a..5c8f63d4c 100644 --- a/src/baselib/ocsigen_lib_base.ml +++ b/src/baselib/ocsigen_lib_base.ml @@ -23,8 +23,8 @@ exception Ocsigen_Request_too_long external id : 'a -> 'a = "%identity" -let ( >>= ) = Lwt.bind -let ( >|= ) = Lwt.( >|= ) +include Lwt.Infix + let ( !! ) = Lazy.force let ( |> ) x f = f x let ( @@ ) f x = f x @@ -62,17 +62,6 @@ module Option = struct let return x = Some x let bind opt k = match opt with Some x -> k x | None -> None let to_list = function None -> [] | Some v -> [v] - - module Lwt = struct - let map f = function - | Some x -> f x >>= fun v -> Lwt.return (Some v) - | None -> Lwt.return None - - let get f = function Some x -> Lwt.return x | None -> f () - let get' a = function Some x -> Lwt.return x | None -> a - let iter f = function Some x -> f x | None -> Lwt.return () - let bind opt k = match opt with Some x -> k x | None -> Lwt.return None - end end module List = struct diff --git a/src/baselib/ocsigen_lib_base.mli b/src/baselib/ocsigen_lib_base.mli index d5251dcb4..bc68b8a7c 100644 --- a/src/baselib/ocsigen_lib_base.mli +++ b/src/baselib/ocsigen_lib_base.mli @@ -26,8 +26,8 @@ exception Input_is_too_large exception Ocsigen_Bad_Request exception Ocsigen_Request_too_long -val ( >>= ) : 'a Lwt.t -> ('a -> 'b Lwt.t) -> 'b Lwt.t -val ( >|= ) : 'a Lwt.t -> ('a -> 'b) -> 'b Lwt.t +include module type of Lwt.Infix + val ( !! ) : 'a Lazy.t -> 'a val ( |> ) : 'a -> ('a -> 'b) -> 'b val ( @@ ) : ('a -> 'b) -> 'a -> 'b @@ -63,14 +63,6 @@ module Option : sig val return : 'a -> 'a t val bind : 'a t -> ('a -> 'b t) -> 'b t val to_list : 'a t -> 'a list - - module Lwt : sig - val map : ('a -> 'b Lwt.t) -> 'a t -> 'b t Lwt.t - val get : (unit -> 'a Lwt.t) -> 'a t -> 'a Lwt.t - val get' : 'a Lwt.t -> 'a t -> 'a Lwt.t - val iter : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t - val bind : 'a t -> ('a -> 'b t Lwt.t) -> 'b t Lwt.t - end end (** Improvement of module List *) diff --git a/src/server/ocsigen_messages.ml b/src/server/ocsigen_messages.ml index 137b81fe5..6c702ae98 100644 --- a/src/server/ocsigen_messages.ml +++ b/src/server/ocsigen_messages.ml @@ -18,7 +18,8 @@ (** Writing messages in the logs *) -let ( >>= ) = Lwt.bind +open Lwt.Infix + let access_file = "access.log" let warning_file = "warnings.log" let error_file = "errors.log"