diff options
Diffstat (limited to 'stdlib/source/library/lux/time/day.lux')
-rw-r--r-- | stdlib/source/library/lux/time/day.lux | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index b4eb13ede..2a717427e 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -1,22 +1,23 @@ (.using - [library - [lux {"-" nat} - [abstract - [equivalence {"+" Equivalence}] - [hash {"+" Hash}] - [order {"+" Order}] - [enum {"+" Enum}] - [codec {"+" Codec}]] - [control - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}]] - [data - ["[0]" text ("[1]#[0]" monoid)]] - [macro - ["[0]" template]] - [math - [number - ["n" nat]]]]]) + [library + [lux {"-" nat} + [abstract + [equivalence {"+" Equivalence}] + [hash {"+" Hash}] + [order {"+" Order}] + [enum {"+" Enum}] + [codec {"+" Codec}]] + [control + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}]] + [data + ["[0]" text ("[1]#[0]" monoid)]] + [macro + ["^" pattern] + ["[0]" template]] + [math + [number + ["n" nat]]]]]) (type: .public Day (Variant @@ -33,7 +34,7 @@ (def: (= reference sample) (case [reference sample] - (^template [<tag>] + (^.template [<tag>] [[{<tag>} {<tag>}] #1]) ([#Sunday] @@ -100,7 +101,7 @@ (def: (encoded value) (case value - (^template [<tag>] + (^.template [<tag>] [{<tag>} (text.replaced "#" "" (template.text [<tag>]))]) ([..#Monday] @@ -112,8 +113,8 @@ [..#Sunday]))) (def: (decoded value) (case (text#composite "#" value) - (^template [<tag>] - [(^ (template.text [<tag>])) + (^.template [<tag>] + [(pattern (template.text [<tag>])) {try.#Success {<tag>}}]) ([..#Monday] [..#Tuesday] @@ -144,7 +145,7 @@ (def: .public (number day) (-> Day Nat) (case day - (^template [<number> <day>] + (^.template [<number> <day>] [{<day>} <number>]) (<pairs>))) @@ -160,7 +161,7 @@ (def: .public (by_number number) (-> Nat (Try Day)) (case number - (^template [<number> <day>] + (^.template [<number> <day>] [<number> {try.#Success {<day>}}]) (<pairs>) @@ -175,7 +176,7 @@ (def: &equivalence ..equivalence) (def: (hash day) (case day - (^template [<prime> <day>] + (^.template [<prime> <day>] [{<day>} <prime>]) ([02 #Sunday] |