aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/net/http/client.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/world/net/http/client.lux')
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux46
1 files changed, 23 insertions, 23 deletions
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 7f0a1588f..f2e709dbd 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -45,7 +45,7 @@
(All (_ !)
(-> URL //.Headers (Maybe Binary) (Client !)
(! (Try (//.Response !)))))
- (# client request {<method>} url headers data)))]
+ (at client request {<method>} url headers data)))]
[//.#Post]
[//.#Get]
@@ -137,8 +137,8 @@
(loop (again [so_far +0])
(do [! (try.with io.monad)]
[.let [remaining (i.- so_far (.int buffer_size))]
- bytes_read (# ! each (|>> ffi.of_int)
- (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
+ bytes_read (at ! each (|>> ffi.of_int)
+ (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
(case bytes_read
-1 (do !
[_ (java/lang/AutoCloseable::close input)]
@@ -148,11 +148,11 @@
(in [buffer_size buffer])
(again (i.+ bytes_read so_far))))))
(loop (again [so_far +0
- output (# binary.monoid identity)])
+ output (at binary.monoid identity)])
(do [! (try.with io.monad)]
[.let [remaining (i.- so_far (.int buffer_size))]
- bytes_read (# ! each (|>> ffi.of_int)
- (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
+ bytes_read (at ! each (|>> ffi.of_int)
+ (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))]
(case bytes_read
-1 (do !
[_ (java/lang/AutoCloseable::close input)]
@@ -160,14 +160,14 @@
+0 (in (..body_of output))
_ (|> buffer
(binary.slice 0 (.nat so_far))
- (# try.functor each
- (|>> (# binary.monoid composite output)
- ..body_of))
- (# io.monad in))))
+ (at try.functor each
+ (|>> (at binary.monoid composite output)
+ ..body_of))
+ (at io.monad in))))
+0 (again so_far output)
_ (if (i.= remaining bytes_read)
(again +0
- (# binary.monoid composite output buffer))
+ (at binary.monoid composite output buffer))
(again (i.+ bytes_read so_far)
output))))))))))
@@ -215,7 +215,7 @@
headers (..default_headers connection)
input (|> connection
java/net/URLConnection::getInputStream
- (# ! each (|>> java/io/BufferedInputStream::new)))]
+ (at ! each (|>> java/io/BufferedInputStream::new)))]
(in [(.nat (ffi.of_int status))
[//.#headers headers
//.#body (..default_body input)]]))))))]
@@ -227,18 +227,18 @@
(-> (Client IO) (Client Async))
(def: (request method url headers data)
- (|> (# client request method url headers data)
+ (|> (at client request method url headers data)
async.future
- (# async.monad each
- (|>> (pipe.case
- {try.#Success [status message]}
- {try.#Success [status (revised //.#body (is (-> (//.Body IO) (//.Body Async))
- (function (_ body)
- (|>> body async.future)))
- message)]}
-
- {try.#Failure error}
- {try.#Failure error}))))))
+ (at async.monad each
+ (|>> (pipe.case
+ {try.#Success [status message]}
+ {try.#Success [status (revised //.#body (is (-> (//.Body IO) (//.Body Async))
+ (function (_ body)
+ (|>> body async.future)))
+ message)]}
+
+ {try.#Failure error}
+ {try.#Failure error}))))))
(def: .public headers
(-> (List [Text Text]) //.Headers)