Skip to content

Commit

Permalink
Split Caqti_prereq into Caqti_common and Caqti_common_priv.
Browse files Browse the repository at this point in the history
  • Loading branch information
paurkedal committed Oct 1, 2019
1 parent b6e2f42 commit 88f8d4f
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib-async/caqti_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

open Async_kernel
open Async_unix
open Caqti_prereq
open Caqti_common_priv
open Core_kernel

module System = struct
Expand Down
4 changes: 2 additions & 2 deletions lib-blocking/caqti_blocking.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2018 Petter A. Urkedal <[email protected]>
(* Copyright (C) 2018--2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
Expand All @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv

module System = struct

Expand Down
2 changes: 1 addition & 1 deletion lib-driver/caqti_driver_mariadb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*)

open Caqti_driver_lib
open Caqti_prereq
open Caqti_common_priv
open Printf

type Caqti_error.msg += Mdb_msg of (int * string)
Expand Down
2 changes: 1 addition & 1 deletion lib-driver/caqti_driver_postgresql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv
open Printf
module Pg = Postgresql

Expand Down
2 changes: 1 addition & 1 deletion lib-driver/caqti_driver_sqlite3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv
open Caqti_driver_lib
open Printf

Expand Down
4 changes: 2 additions & 2 deletions lib-lwt/caqti_lwt.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2014--2018 Petter A. Urkedal <[email protected]>
(* Copyright (C) 2014--2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
Expand All @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv

module System = struct

Expand Down
19 changes: 19 additions & 0 deletions lib/caqti_common.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(* Copyright (C) 2014--2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version, with the OCaml static compilation exception.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

type counit = {absurd: 'a. 'a}

let absurd {absurd} = absurd
21 changes: 21 additions & 0 deletions lib/caqti_common.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(* Copyright (C) 2014--2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version, with the OCaml static compilation exception.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

(** Prerequisites. *)

type counit

val absurd : counit -> 'a
6 changes: 1 addition & 5 deletions lib/caqti_prereq.ml → lib/caqti_common_priv.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2014--2019 Petter A. Urkedal <[email protected]>
(* Copyright (C) 2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
Expand All @@ -16,10 +16,6 @@

open Printf

type counit = {absurd: 'a. 'a}

let absurd {absurd} = absurd

let ident x = x

let (%) g f x = g (f x)
Expand Down
12 changes: 4 additions & 8 deletions lib/caqti_prereq.mli → lib/caqti_common_priv.mli
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2014--2019 Petter A. Urkedal <[email protected]>
(* Copyright (C) 2019 Petter A. Urkedal <[email protected]>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
Expand All @@ -14,14 +14,10 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

(** Prerequisites. *)
(** {b Internal:} Prerequisites.
type counit

val absurd : counit -> 'a

(**/**)
(* The rest are for internal use only. *)
This module is ment for internal use by Caqti and may change in backwards
incompatible ways between minor versions without prior notice. *)

val (%) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
Expand Down
2 changes: 1 addition & 1 deletion lib/caqti_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv
open Printf

module Make_helpers
Expand Down
2 changes: 1 addition & 1 deletion lib/caqti_driver_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv

let linear_param_length templ =
let rec loop = function
Expand Down
2 changes: 1 addition & 1 deletion lib/caqti_error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ let show err =

let uncongested = function
| Error #t | Ok _ as x -> x
| Error `Congested x -> Caqti_prereq.absurd x
| Error `Congested x -> Caqti_common.absurd x

exception Exn of t

Expand Down
2 changes: 1 addition & 1 deletion lib/caqti_error.mli
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ val show : [< t] -> string
(** [show error] is an explanation of [error]. *)

val uncongested :
('a, [< t | `Congested of Caqti_prereq.counit]) result ->
('a, [< t | `Congested of Caqti_common.counit]) result ->
('a, [> t]) result
(** [uncongested r] eliminates an unused [`Congested] case from the error. *)

Expand Down
3 changes: 2 additions & 1 deletion lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Caqti_mult
Caqti_pool
Caqti_pool_sig
Caqti_common
Caqti_query
Caqti_request
Caqti_response_sig
Expand All @@ -26,7 +27,7 @@
Caqti_type_sig
; internal
Caqti_heap
Caqti_prereq)
Caqti_common_priv)
(modules_without_implementation
Caqti_connect_sig
Caqti_connection_sig
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)

open Caqti_prereq
open Caqti_common_priv
open Printf

module Q = struct
Expand Down

0 comments on commit 88f8d4f

Please sign in to comment.