Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions src/baselib/ocsigen_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@author Raphaël Proust (adding timers)
*)

let ( >>= ) = Lwt.bind
open Lwt.Infix

module Dlist : sig
type 'a t
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/baselib/ocsigen_cache.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 2 additions & 13 deletions src/baselib/ocsigen_lib_base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/baselib/ocsigen_lib_base.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 *)
Expand Down
3 changes: 2 additions & 1 deletion src/server/ocsigen_messages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down