From cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 01:21:23 -0400 Subject: Migrated variants to the new syntax. --- stdlib/source/documentation/lux.lux | 76 ++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'stdlib/source/documentation/lux.lux') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index e81beecb2..0f6e94998 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -329,17 +329,17 @@ (type: Type (Rec @ (Variant - (#Primitive Text (List @)) - (#Sum @ @) - (#Product @ @) - (#Function @ @) - (#Parameter Nat) - (#Var Nat) - (#Ex Nat) - (#UnivQ (List @) @) - (#ExQ (List @) @) - (#Apply @ @) - (#Named Name @))))]) + {#Primitive Text (List @)} + {#Sum @ @} + {#Product @ @} + {#Function @ @} + {#Parameter Nat} + {#Var Nat} + {#Ex Nat} + {#UnivQ (List @) @} + {#ExQ (List @) @} + {#Apply @ @} + {#Named Name @})))]) (documentation: /.exec "Sequential execution of expressions (great for side-effects)." @@ -354,8 +354,8 @@ \n "Allows the usage of macros within the patterns to provide custom syntax.") [(case (: (List Int) (list +1 +2 +3)) - (#Item x (#Item y (#Item z #End))) - (#Some ($_ * x y z)) + {#Item x {#Item y {#Item z #End}}} + {#Some ($_ * x y z)} _ #None)]) @@ -366,7 +366,7 @@ [(case (: (List Int) (list +1 +2 +3)) (^ (list x y z)) - (#Some ($_ * x y z)) + {#Some ($_ * x y z)} _ #None)]) @@ -435,7 +435,7 @@ [(macro: .public (name_of tokens) (case tokens (^template [] - [(^ (list [_ ( [module name])])) + [(^ (list [_ { [module name]}])) (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) ([#Identifier] [#Tag]) @@ -489,8 +489,8 @@ [(type: Referrals (Variant #All - (#Only (List Text)) - (#Exclude (List Text)) + {#Only (List Text)} + {#Exclude (List Text)} #Ignore #Nothing))]) @@ -506,7 +506,7 @@ "The type-definition macro." [(type: (List a) #End - (#Item a (List a)))]) + {#Item a (List a)})]) (documentation: /.Interface "Interface definition." @@ -540,13 +540,13 @@ (loop [end to output #.End] (cond (< end from) - (recur (pred end) (#.Item end output)) + (recur (pred end) {#.Item end output}) (< from end) - (recur (succ end) (#.Item end output)) + (recur (succ end) {#.Item end output}) ... (= end from) - (#.Item end output)))))]) + {#.Item end output}))))]) (documentation: /.cond "Conditional branching with multiple test conditions." @@ -640,30 +640,30 @@ [(def: (reduced env type) (-> (List Type) Type Type) (case type - (#.Primitive name params) - (#.Primitive name (list\each (reduced env) params)) + {#.Primitive name params} + {#.Primitive name (list\each (reduced env) params)} (^template [] - [( left right) - ( (reduced env left) (reduced env right))]) + [{ left right} + { (reduced env left) (reduced env right)}]) ([#.Sum] [#.Product]) (^template [] - [( left right) - ( (reduced env left) (reduced env right))]) + [{ left right} + { (reduced env left) (reduced env right)}]) ([#.Function] [#.Apply]) (^template [] - [( old_env def) + [{ old_env def} (case old_env #.End - ( env def) + { env def} _ type)]) ([#.UnivQ] [#.ExQ]) - (#.Parameter idx) + {#.Parameter idx} (else type (list.item idx env)) _ @@ -751,21 +751,21 @@ (format "Multi-level pattern matching." \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") [(case (split (size static) uri) - (^multi (#Some [chunk uri']) + (^multi {#Some [chunk uri']} [(text\= static chunk) #1]) (match_uri endpoint? parts' uri') _ - (#Left (format "Static part " (%t static) " does not match URI: " uri)))] + {#Left (format "Static part " (%t static) " does not match URI: " uri)})] ["Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) - (^multi (#Some [chunk uri']) + (^multi {#Some [chunk uri']} (text\= static chunk)) (match_uri endpoint? parts' uri') _ - (#Left (format "Static part " (%t static) " does not match URI: " uri)))]) + {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) (documentation: /.name_of "Given an identifier or a tag, gives back a 2 tuple with the module and name parts, both as Text." @@ -875,8 +875,8 @@ "Generates pattern-matching code for Code values in a way that looks like code-templating." [(: (Maybe Nat) (case (` (#0 123 +456.789)) - (^code (#0 (~ [_ (#.Nat number)]) +456.789)) - (#.Some number) + (^code (#0 (~ [_ {#.Nat number}]) +456.789)) + {#.Some number} _ #.None))]) @@ -898,11 +898,11 @@ (case (: (Either Text Bar) (try (: Bar (risky computation which may panic)))) - (#.Right success) + {#.Right success} (: Foo (do something after success)) - (#.Left error) + {#.Left error} (: Foo (recover from error))))]) -- cgit v1.2.3