From 382fc9298fb10f7aac5aa541ce3001580e9bd6d0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 21 Mar 2019 18:48:51 -0400 Subject: Small adjustments. --- stdlib/source/lux/control/remember.lux | 10 +++++----- stdlib/source/lux/data/format/html.lux | 27 +++++++++++++++------------ stdlib/source/lux/world/net/http/response.lux | 10 +++++----- stdlib/source/lux/world/service/journal.lux | 18 +++++++++--------- 4 files changed, 34 insertions(+), 31 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/control/remember.lux b/stdlib/source/lux/control/remember.lux index 6bd64a798..22488c4e2 100644 --- a/stdlib/source/lux/control/remember.lux +++ b/stdlib/source/lux/control/remember.lux @@ -2,7 +2,7 @@ [lux #* [control [monad (#+ do)] - ["p" parser ("#;." functor)] + ["p" parser ("#@." functor)] ["ex" exception (#+ exception:)]] [data ["." error] @@ -10,7 +10,7 @@ format]] [time ["." instant] - ["." date (#+ Date) ("#;." order codec)]] + ["." date (#+ Date) ("#@." order codec)]] ["." macro ["." code] ["s" syntax (#+ Syntax syntax:)]] @@ -28,7 +28,7 @@ (def: deadline (Syntax Date) ($_ p.either - (p;map (|>> instant.from-millis instant.date) + (p@map (|>> instant.from-millis instant.date) s.int) (do p.monad [raw s.text] @@ -42,7 +42,7 @@ (syntax: #export (remember {deadline ..deadline} {message s.text} {focus (p.maybe s.any)}) (let [now (io.run instant.now) today (instant.date now)] - (if (date/< deadline today) + (if (date@< deadline today) (wrap (case focus (#.Some focus) (list focus) @@ -53,7 +53,7 @@ (do-template [ ] [(syntax: #export ( {deadline ..deadline} {message s.text} {focus (p.maybe s.any)}) - (wrap (list (` (..remember (~ (code.text (date/encode deadline))) + (wrap (list (` (..remember (~ (code.text (date@encode deadline))) (~ (code.text (format " " message))) (~+ (case focus (#.Some focus) diff --git a/stdlib/source/lux/data/format/html.lux b/stdlib/source/lux/data/format/html.lux index 0cf59690c..206485991 100644 --- a/stdlib/source/lux/data/format/html.lux +++ b/stdlib/source/lux/data/format/html.lux @@ -1,15 +1,17 @@ (.module: [lux (#- Meta Source comment and) + ["." function] [data ["." product] - ["." maybe] + ["." maybe ("#@." functor)] ["." text format] [collection - ["." list ("#;." functor fold)]]] - ["." function] + ["." list ("#@." functor fold)]]] [type abstract] + [host + ["." js]] [macro ["." template]] [world @@ -28,7 +30,7 @@ {#.doc "Attributes for an HTML tag."} (List [Text Text])) -(type: #export Script Text) +(type: #export Script js.Statement) (type: #export Target #Blank @@ -58,7 +60,7 @@ (def: attributes (-> Attributes Text) - (|>> (list;map (function (_ [key val]) + (|>> (list@map (function (_ [key val]) (format key "=" text.double-quote (..sanitize val) text.double-quote))) (text.join-with " "))) @@ -186,6 +188,7 @@ (def: #export (script attributes inline) (-> Attributes (Maybe Script) Meta) (|> inline + (maybe@map js.code) (maybe.default "") (..raw "script" attributes))) @@ -253,7 +256,7 @@ (def: (%polygon [first second third extra]) (Format Polygon) (|> (list& first second third extra) - (list;map %coord) + (list@map %coord) (text.join-with ..coord-separator))) (type: #export Shape @@ -289,13 +292,13 @@ (-> Attributes (List [Attributes Shape]) Image Image) ($_ ..and for - (case (list;map (product.uncurry ..area) areas) + (case (list@map (product.uncurry ..area) areas) #.Nil (..empty "map" attributes) (#.Cons head tail) (..tag "map" attributes - (list;fold (function.flip ..and) head tail))))) + (list@fold (function.flip ..and) head tail))))) (do-template [ ] [(def: #export @@ -449,7 +452,7 @@ (def: #export (description-list attributes descriptions) (-> Attributes (List [Content Element]) Element) - (case (list;map (function (_ [term description]) + (case (list@map (function (_ [term description]) ($_ ..and (..term term) (..description description))) @@ -459,7 +462,7 @@ (#.Cons head tail) (..tag "dl" attributes - (list;fold (function.flip ..and) head tail)))) + (list@fold (function.flip ..and) head tail)))) (def: #export p ..paragraph) @@ -511,14 +514,14 @@ (def: #export (table attributes caption columns headers rows footer) (-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element) (let [head (..table-head (..table-row headers)) - content (case (list;map table-row rows) + content (case (list@map table-row rows) #.Nil head (#.Cons first rest) (..and head (..table-body - (list;fold (function.flip ..and) first rest)))) + (list@fold (function.flip ..and) first rest)))) content (case footer #.None content diff --git a/stdlib/source/lux/world/net/http/response.lux b/stdlib/source/lux/world/net/http/response.lux index bac0fcaaa..3be1e1454 100644 --- a/stdlib/source/lux/world/net/http/response.lux +++ b/stdlib/source/lux/world/net/http/response.lux @@ -3,7 +3,7 @@ [control [concurrency ["." promise] - ["." frp ("#;." monad)]]] + ["." frp ("#@." monad)]]] [data ["." text format @@ -12,7 +12,7 @@ ["." html] ["." css (#+ CSS)] ["." context] - ["." json (#+ JSON) ("#;." codec)]]] + ["." json (#+ JSON) ("#@." codec)]]] ["." io] [world ["." binary (#+ Binary)]]] @@ -29,7 +29,7 @@ (def: #export empty (-> Status Response) - (let [body (frp;wrap (encoding.to-utf8 ""))] + (let [body (frp@wrap (encoding.to-utf8 ""))] (function (_ status) [status {#//.headers (|> context.empty @@ -52,7 +52,7 @@ {#//.headers (|> context.empty (header.content-length (binary.size data)) (header.content-type type)) - #//.body (frp;wrap data)}]) + #//.body (frp@wrap data)}]) (def: #export bad-request (-> Text Response) @@ -70,5 +70,5 @@ [text Text mime.utf-8 (<|)] [html html.Document mime.html html.html] [css CSS mime.css css.css] - [json JSON mime.json json/encode] + [json JSON mime.json json@encode] ) diff --git a/stdlib/source/lux/world/service/journal.lux b/stdlib/source/lux/world/service/journal.lux index 6a2e8ff90..4a3c7b62f 100644 --- a/stdlib/source/lux/world/service/journal.lux +++ b/stdlib/source/lux/world/service/journal.lux @@ -7,9 +7,9 @@ ["!" capability (#+ capability:)]]] [data [error (#+ Error)] - ["." text ("#;." equivalence)]] + ["." text ("#@." equivalence)]] [time - ["." instant (#+ Instant) ("#;." equivalence)]]]) + ["." instant (#+ Instant) ("#@." equivalence)]]]) (type: #export (Entry a) {#what a @@ -29,15 +29,15 @@ (def: bottom start) (def: top end))) -(structure: #export (equivalence (^open "_;.")) +(structure: #export (equivalence (^open "_@.")) (All [a] (-> (Equivalence a) (Equivalence (Entry a)))) (def: (= reference sample) - (and (_;= (get@ #what reference) (get@ #what sample)) - (text;= (get@ #why reference) (get@ #why sample)) - (text;= (get@ #how reference) (get@ #how sample)) - (text;= (get@ #who reference) (get@ #who sample)) - (text;= (get@ #where reference) (get@ #where sample)) - (instant/= (get@ #when reference) (get@ #when sample))))) + (and (_@= (get@ #what reference) (get@ #what sample)) + (text@= (get@ #why reference) (get@ #why sample)) + (text@= (get@ #how reference) (get@ #how sample)) + (text@= (get@ #who reference) (get@ #who sample)) + (text@= (get@ #where reference) (get@ #where sample)) + (instant@= (get@ #when reference) (get@ #when sample))))) (capability: #export (Can-Write ! a) (can-write (Entry a) (! (Error Any)))) -- cgit v1.2.3