From 8c3a1afab9efeb86e2f53d743551fc689fbad257 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 12 Jun 2022 13:33:48 -0400 Subject: De-sigil-ification: suffix : [Part 4] --- .../source/program/aedifex/repository/remote.lux | 80 +++++++++++----------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'stdlib/source/program/aedifex/repository/remote.lux') diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 29bcbad84..b5fbc6b13 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -54,45 +54,45 @@ (List [Text Text]) (list ["User-Agent" ..user_agent])) -(implementation: .public (repository http identity address) +(def: .public (repository http identity address) (All (_ s) (-> (http.Client IO) (Maybe Identity) Address (//.Repository IO))) + (implementation + (def: description + address) + (def: (download uri) + (do [! (try.with io.monad)] + [[status message] (is (IO (Try (@http.Response IO))) + (http.get (format address uri) + (http.headers ..base_headers) + {.#None} + http))] + (case status + (pattern (static http/status.ok)) + (at ! each product.right ((the @http.#body message) {.#None})) + + _ + (do ! + [_ ((the @http.#body message) {.#Some 0})] + (at io.monad in (exception.except ..download_failure [(format address uri) status])))))) - (def: description - address) - (def: (download uri) - (do [! (try.with io.monad)] - [[status message] (is (IO (Try (@http.Response IO))) - (http.get (format address uri) - (http.headers ..base_headers) - {.#None} - http))] - (case status - (pattern (static http/status.ok)) - (at ! each product.right ((the @http.#body message) {.#None})) - - _ - (do ! - [_ ((the @http.#body message) {.#Some 0})] - (at io.monad in (exception.except ..download_failure [(format address uri) status])))))) - - (def: (upload uri content) - (do (try.with io.monad) - [[status message] (is (IO (Try (@http.Response IO))) - (http.put (format address uri) - (http.headers (case identity - {.#None} - ..base_headers - - {.#Some [user password]} - (partial_list ["Authorization" (//identity.basic_auth user password)] - ..base_headers))) - {.#Some content} - http)) - _ ((the @http.#body message) {.#Some 0})] - (case status - (pattern (static http/status.created)) - (in []) - - _ - (at io.monad in (exception.except ..upload_failure [(format address uri) status]))))) - ) + (def: (upload uri content) + (do (try.with io.monad) + [[status message] (is (IO (Try (@http.Response IO))) + (http.put (format address uri) + (http.headers (case identity + {.#None} + ..base_headers + + {.#Some [user password]} + (partial_list ["Authorization" (//identity.basic_auth user password)] + ..base_headers))) + {.#Some content} + http)) + _ ((the @http.#body message) {.#Some 0})] + (case status + (pattern (static http/status.created)) + (in []) + + _ + (at io.monad in (exception.except ..upload_failure [(format address uri) status]))))) + )) -- cgit v1.2.3