diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/world/net.lux | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http.lux | 34 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/client.lux | 10 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/cookie.lux | 16 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/header.lux | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/mime.lux | 12 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/query.lux | 2 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/request.lux | 10 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/response.lux | 16 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/route.lux | 8 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/status.lux | 2 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/http/version.lux | 2 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/net/uri.lux | 4 |
13 files changed, 66 insertions, 66 deletions
diff --git a/stdlib/source/library/lux/world/net.lux b/stdlib/source/library/lux/world/net.lux index cea1b4a7d..76b85d499 100644 --- a/stdlib/source/library/lux/world/net.lux +++ b/stdlib/source/library/lux/world/net.lux @@ -2,12 +2,12 @@ [library [lux (#- Location)]]) -(type: #export Address Text) +(type: .public Address Text) -(type: #export Port Nat) +(type: .public Port Nat) -(type: #export URL Text) +(type: .public URL Text) -(type: #export Location +(type: .public Location {#address Address #port Port}) diff --git a/stdlib/source/library/lux/world/net/http.lux b/stdlib/source/library/lux/world/net/http.lux index c526e6c97..2c0877351 100644 --- a/stdlib/source/library/lux/world/net/http.lux +++ b/stdlib/source/library/lux/world/net/http.lux @@ -12,10 +12,10 @@ [// (#+ URL) [uri (#+ URI)]]) -(type: #export Version +(type: .public Version Text) -(type: #export Method +(type: .public Method #Post #Get #Put @@ -26,54 +26,54 @@ #Options #Trace) -(type: #export Port +(type: .public Port Nat) -(type: #export Status +(type: .public Status Nat) -(type: #export Headers +(type: .public Headers Environment) -(def: #export empty +(def: .public empty Headers environment.empty) -(type: #export Header +(type: .public Header (-> Headers Headers)) -(type: #export (Body !) +(type: .public (Body !) (-> (Maybe Nat) (! (Try [Nat Binary])))) -(type: #export Scheme +(type: .public Scheme #HTTP #HTTPS) -(type: #export Address +(type: .public Address {#port Port #host Text}) -(type: #export Identification +(type: .public Identification {#local Address #remote Address}) -(type: #export Protocol +(type: .public Protocol {#version Version #scheme Scheme}) -(type: #export Resource +(type: .public Resource {#method Method #uri URI}) -(type: #export (Message !) +(type: .public (Message !) {#headers Headers #body (Body !)}) -(type: #export (Request !) +(type: .public (Request !) [Identification Protocol Resource (Message !)]) -(type: #export (Response !) +(type: .public (Response !) [Status (Message !)]) -(type: #export (Server !) +(type: .public (Server !) (-> (Request !) (! (Response !)))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index fd79fc81b..8055dce6e 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -24,13 +24,13 @@ ["." // [// (#+ URL)]]) -(interface: #export (Client !) +(interface: .public (Client !) (: (-> //.Method URL //.Headers (Maybe Binary) (! (Try (//.Response !)))) request)) (template [<name> <method>] - [(def: #export (<name> url headers data client) + [(def: .public (<name> url headers data client) (All [!] (-> URL //.Headers (Maybe Binary) (Client !) (! (Try (//.Response !))))) @@ -170,7 +170,7 @@ #.None (in headers))))) - (implementation: #export default + (implementation: .public default (Client IO) (def: (request method url headers data) @@ -206,7 +206,7 @@ @.jvm (as_is <jvm>)} (as_is))) -(implementation: #export (async client) +(implementation: .public (async client) (-> (Client IO) (Client Async)) (def: (request method url headers data) @@ -222,6 +222,6 @@ (#try.Failure error) (#try.Failure error))))))) -(def: #export headers +(def: .public headers (-> (List [Text Text]) //.Headers) (dictionary.of_list text.hash)) diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux index 2c5965338..1e4623761 100644 --- a/stdlib/source/library/lux/world/net/http/cookie.lux +++ b/stdlib/source/library/lux/world/net/http/cookie.lux @@ -20,7 +20,7 @@ ["." // (#+ Header) ["." header]]) -(type: #export Directive +(type: .public Directive (-> Text Text)) (def: (directive extension) @@ -28,11 +28,11 @@ (function (_ so_far) (format so_far "; " extension))) -(def: #export (set name value) +(def: .public (set name value) (-> Text Text Header) (header.add "Set-Cookie" (format name "=" value))) -(def: #export (max_age duration) +(def: .public (max_age duration) (-> Duration Directive) (let [seconds (duration.query duration.second duration)] (..directive (format "Max-Age=" (if (i.< +0 seconds) @@ -40,7 +40,7 @@ (%.nat (.nat seconds))))))) (template [<name> <prefix>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> Text Directive) (..directive (format <prefix> "=" value)))] @@ -49,7 +49,7 @@ ) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Directive (..directive <tag>))] @@ -57,11 +57,11 @@ [http_only "HttpOnly"] ) -(type: #export CSRF_Policy +(type: .public CSRF_Policy #Strict #Lax) -(def: #export (same_site policy) +(def: .public (same_site policy) (-> CSRF_Policy Directive) (..directive (format "SameSite=" (case policy #Strict "Strict" @@ -84,6 +84,6 @@ (cookies context')) (p\in context))) -(def: #export (get header) +(def: .public (get header) (-> Text (Try Context)) (l.run header (..cookies context.empty))) diff --git a/stdlib/source/library/lux/world/net/http/header.lux b/stdlib/source/library/lux/world/net/http/header.lux index 1d84b3318..6f8d92cc2 100644 --- a/stdlib/source/library/lux/world/net/http/header.lux +++ b/stdlib/source/library/lux/world/net/http/header.lux @@ -12,7 +12,7 @@ ["." mime (#+ MIME)] [// (#+ URL)]]) -(def: #export (add name value) +(def: .public (add name value) (-> Text Text Header) (dictionary.upsert name "" (|>> (case> @@ -22,14 +22,14 @@ previous (format previous "," value))))) -(def: #export content_length +(def: .public content_length (-> Nat Header) (|>> %.nat (..add "Content-Length"))) -(def: #export content_type +(def: .public content_type (-> MIME Header) (|>> mime.name (..add "Content-Type"))) -(def: #export location +(def: .public location (-> URL Header) (..add "Location")) diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux index 445796038..1592b3d25 100644 --- a/stdlib/source/library/lux/world/net/http/mime.lux +++ b/stdlib/source/library/lux/world/net/http/mime.lux @@ -8,23 +8,23 @@ [type abstract]]]) -(abstract: #export MIME +(abstract: .public MIME Text {#doc "Multipurpose Internet Mail Extensions"} - (def: #export mime + (def: .public mime (-> Text MIME) (|>> :abstraction)) - (def: #export name + (def: .public name (-> MIME Text) (|>> :representation)) ) ## https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types (template [<name> <type>] - [(def: #export <name> MIME (..mime <type>))] + [(def: .public <name> MIME (..mime <type>))] [aac_audio "audio/aac"] [abiword "application/x-abiword"] @@ -93,10 +93,10 @@ [!7z "application/x-7z-compressed"] ) -(def: #export (text encoding) +(def: .public (text encoding) (-> Encoding MIME) (..mime (format "text/plain; charset=" text.double_quote (encoding.name encoding) text.double_quote))) -(def: #export utf_8 +(def: .public utf_8 MIME (..text encoding.utf_8)) diff --git a/stdlib/source/library/lux/world/net/http/query.lux b/stdlib/source/library/lux/world/net/http/query.lux index 0f78ba5e3..d0be7dfc3 100644 --- a/stdlib/source/library/lux/world/net/http/query.lux +++ b/stdlib/source/library/lux/world/net/http/query.lux @@ -60,6 +60,6 @@ ## if invalid form data, just stop parsing... (\ p.monad in context))) -(def: #export (parameters raw) +(def: .public (parameters raw) (-> Text (Try Context)) (l.run raw (..form context.empty))) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 7ef59466b..8ab9265cb 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -52,7 +52,7 @@ (def: failure (//response.bad_request "")) -(def: #export (json reader server) +(def: .public (json reader server) (All [a] (-> (<json>.Reader a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -67,7 +67,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (text server) +(def: .public (text server) (-> (-> Text Server) Server) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -79,7 +79,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (query property server) +(def: .public (query property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ [identification protocol resource message]) (let [full (get@ #//.uri resource) @@ -97,7 +97,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (form property server) +(def: .public (form property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (do async.monad @@ -112,7 +112,7 @@ (#try.Failure error) (async.resolved ..failure))))) -(def: #export (cookies property server) +(def: .public (cookies property server) (All [a] (-> (Property a) (-> a Server) Server)) (function (_ (^@ request [identification protocol resource message])) (case (do try.monad diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux index c32094707..9d74ced0c 100644 --- a/stdlib/source/library/lux/world/net/http/response.lux +++ b/stdlib/source/library/lux/world/net/http/response.lux @@ -22,12 +22,12 @@ ["." header] [// (#+ URL)]]) -(def: #export (static response) +(def: .public (static response) (-> Response Server) (function (_ request) (async.resolved response))) -(def: #export empty +(def: .public empty (-> Status Response) (let [body (frp\in (\ encoding.utf8 encode ""))] (function (_ status) @@ -37,16 +37,16 @@ (header.content_type mime.utf_8)) #//.body body}]))) -(def: #export (temporary_redirect to) +(def: .public (temporary_redirect to) (-> URL Response) (let [[status message] (..empty status.temporary_redirect)] [status (update@ #//.headers (header.location to) message)])) -(def: #export not_found +(def: .public not_found Response (..empty status.not_found)) -(def: #export (content status type data) +(def: .public (content status type data) (-> Status MIME Binary Response) [status {#//.headers (|> context.empty @@ -54,16 +54,16 @@ (header.content_type type)) #//.body (frp\in data)}]) -(def: #export bad_request +(def: .public bad_request (-> Text Response) (|>> (\ encoding.utf8 encode) (content status.bad_request mime.utf_8))) -(def: #export ok +(def: .public ok (-> MIME Binary Response) (content status.ok)) (template [<name> <type> <mime> <pre>] - [(def: #export <name> + [(def: .public <name> (-> <type> Response) (|>> <pre> (\ encoding.utf8 encode) (..ok <mime>)))] diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux index 0dd3f6c5b..15f89bb99 100644 --- a/stdlib/source/library/lux/world/net/http/route.lux +++ b/stdlib/source/library/lux/world/net/http/route.lux @@ -15,7 +15,7 @@ ["#." response]]) (template [<scheme> <name>] - [(def: #export (<name> server) + [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) (case (get@ #//.scheme protocol) @@ -30,7 +30,7 @@ ) (template [<method> <name>] - [(def: #export (<name> server) + [(def: .public (<name> server) (-> Server Server) (function (_ (^@ request [identification protocol resource message])) (case (get@ #//.method resource) @@ -51,7 +51,7 @@ [#//.Trace trace] ) -(def: #export (uri path server) +(def: .public (uri path server) (-> URI Server Server) (function (_ [identification protocol resource message]) (if (text.starts_with? path (get@ #//.uri resource)) @@ -63,7 +63,7 @@ message]) (async.resolved //response.not_found)))) -(def: #export (or primary alternative) +(def: .public (or primary alternative) (-> Server Server Server) (function (_ request) (do async.monad diff --git a/stdlib/source/library/lux/world/net/http/status.lux b/stdlib/source/library/lux/world/net/http/status.lux index fe3f7d90d..0d7d45fd5 100644 --- a/stdlib/source/library/lux/world/net/http/status.lux +++ b/stdlib/source/library/lux/world/net/http/status.lux @@ -5,7 +5,7 @@ ## https://en.wikipedia.org/wiki/List_of_HTTP_status_codes (template [<status> <name>] - [(def: #export <name> + [(def: .public <name> Status <status>)] diff --git a/stdlib/source/library/lux/world/net/http/version.lux b/stdlib/source/library/lux/world/net/http/version.lux index 2443fda12..535d4736a 100644 --- a/stdlib/source/library/lux/world/net/http/version.lux +++ b/stdlib/source/library/lux/world/net/http/version.lux @@ -4,7 +4,7 @@ [// (#+ Version)]) (template [<name> <version>] - [(def: #export <name> Version <version>)] + [(def: .public <name> Version <version>)] [v0_9 "0.9"] [v1_0 "1.0"] diff --git a/stdlib/source/library/lux/world/net/uri.lux b/stdlib/source/library/lux/world/net/uri.lux index 2c43cbbd3..275c1539d 100644 --- a/stdlib/source/library/lux/world/net/uri.lux +++ b/stdlib/source/library/lux/world/net/uri.lux @@ -2,8 +2,8 @@ [library [lux #*]]) -(type: #export URI +(type: .public URI Text) -(def: #export separator +(def: .public separator "/") |