Skip to content

Commit 8858e6d

Browse files
committed
Web: factor types
1 parent a195bfa commit 8858e6d

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

web.ml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ module type CURL = sig
118118
val perform : Curl.t -> Curl.curlCode t
119119
end
120120

121+
type ('body,'ret) http_request_ =
122+
?ua:string ->
123+
?timeout:int ->
124+
?verbose:bool ->
125+
?setup:(Curl.t -> unit) ->
126+
?timer:Action.timer ->
127+
?max_size:int ->
128+
?http_1_0:bool ->
129+
?headers:string list ->
130+
?body:'body ->
131+
http_action -> string -> 'ret
132+
133+
type 'ret http_request = ([ `Form of (string * string) list | `Raw of string * string ], 'ret) http_request_
134+
121135
module type HTTP = sig
122136
module IO : IO_TYPE
123137
val with_curl : (Curl.t -> 'a IO.t) -> 'a IO.t
@@ -130,24 +144,13 @@ module type HTTP = sig
130144
?result:(Curl.t -> Curl.curlCode -> unit IO.t) ->
131145
string -> [ `Error of Curl.curlCode | `Ok of int * string ] IO.t
132146

133-
type ('body,'ret) http_request_ =
134-
?ua:string ->
135-
?timeout:int ->
136-
?verbose:bool ->
137-
?setup:(Curl.t -> unit) ->
138-
?timer:Action.timer ->
139-
?max_size:int ->
140-
?http_1_0:bool ->
141-
?headers:string list ->
142-
?body:'body ->
143-
http_action -> string -> 'ret IO.t
144-
145-
type 'ret http_request = ([ `Form of (string * string) list | `Raw of string * string ], 'ret) http_request_
147+
type ('body,'ret) request_ = ('body,'ret IO.t) http_request_
148+
type 'ret request = 'ret IO.t http_request
146149

147-
val http_request' : [> `Error of Curl.curlCode | `Ok of int * string ] http_request
148-
val http_request : [> `Error of string | `Ok of string ] http_request
149-
val http_request_exn : string http_request
150-
val http_query : (string * string, [> `Error of string | `Ok of string ]) http_request_
150+
val http_request' : [> `Error of Curl.curlCode | `Ok of int * string ] request
151+
val http_request : [> `Error of string | `Ok of string ] request
152+
val http_request_exn : string request
153+
val http_query : (string * string, [> `Error of string | `Ok of string ]) request_
151154
val http_submit :
152155
?ua:string ->
153156
?timeout:int ->
@@ -175,19 +178,8 @@ module Http (IO : IO_TYPE) (Curl_IO : CURL with type 'a t = 'a IO.t) : HTTP with
175178

176179
module IO = IO
177180

178-
type ('body,'ret) http_request_ =
179-
?ua:string ->
180-
?timeout:int ->
181-
?verbose:bool ->
182-
?setup:(Curl.t -> unit) ->
183-
?timer:Action.timer ->
184-
?max_size:int ->
185-
?http_1_0:bool ->
186-
?headers:string list ->
187-
?body:'body ->
188-
http_action -> string -> 'ret IO.t
189-
190-
type 'ret http_request = ([ `Form of (string * string) list | `Raw of string * string ], 'ret) http_request_
181+
type ('body,'ret) request_ = ('body,'ret IO.t) http_request_
182+
type 'ret request = 'ret IO.t http_request
191183

192184
open IO
193185

0 commit comments

Comments
 (0)