aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/repository/remote.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-06-12 13:33:48 -0400
committerEduardo Julian2022-06-12 13:33:48 -0400
commit8c3a1afab9efeb86e2f53d743551fc689fbad257 (patch)
tree396b2fd29bac407544d2136a0d9e6e3b8b2c30af /stdlib/source/program/aedifex/repository/remote.lux
parent9c21fd1f33eb52fb971d493ad21a67036d68b841 (diff)
De-sigil-ification: suffix : [Part 4]
Diffstat (limited to 'stdlib/source/program/aedifex/repository/remote.lux')
-rw-r--r--stdlib/source/program/aedifex/repository/remote.lux80
1 files changed, 40 insertions, 40 deletions
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])))))
+ ))