From 343fda007c09deb70917a4afda19891cacf54504 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 03:09:37 -0400 Subject: Undid the foolish re-design of "abstract:" and "actor:". --- .../lux/control/concurrency/actor.lux | 36 ++++----- stdlib/source/documentation/lux/type/abstract.lux | 94 +++++++++++----------- 2 files changed, 65 insertions(+), 65 deletions(-) (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux index a26d2f2d6..1727f3c5f 100644 --- a/stdlib/source/documentation/lux/control/concurrency/actor.lux +++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux @@ -49,29 +49,29 @@ (with_expansions [ (as_is (actor: .public (stack a) (List a) - [((on_mail mail state self) - (do (try.with async.monad) - [.let [_ (debug.log! "BEFORE")] - output (mail state self) - .let [_ (debug.log! "AFTER")]] - (in output))) - - (message: .public (push [value a] state self) - (List a) - (let [state' {#.Item value state}] - (async.resolved {#try.Success [state' state']})))]) + ((on_mail mail state self) + (do (try.with async.monad) + [.let [_ (debug.log! "BEFORE")] + output (mail state self) + .let [_ (debug.log! "AFTER")]] + (in output))) + + (message: .public (push [value a] state self) + (List a) + (let [state' {#.Item value state}] + (async.resolved {#try.Success [state' state']})))) (actor: .public counter Nat - [(message: .public (count! [increment Nat] state self) - Any - (let [state' (n.+ increment state)] - (async.resolved {#try.Success [state' state']}))) + (message: .public (count! [increment Nat] state self) + Any + (let [state' (n.+ increment state)] + (async.resolved {#try.Success [state' state']}))) - (message: .public (read! state self) - Nat - (async.resolved {#try.Success [state state]}))]))] + (message: .public (read! state self) + Nat + (async.resolved {#try.Success [state state]}))))] (documentation: /.actor: (format "Defines a named actor, with its behavior and internal state." \n "Messages for the actor must be defined after the on_mail handler.") diff --git a/stdlib/source/documentation/lux/type/abstract.lux b/stdlib/source/documentation/lux/type/abstract.lux index b1a945167..b86838ea5 100644 --- a/stdlib/source/documentation/lux/type/abstract.lux +++ b/stdlib/source/documentation/lux/type/abstract.lux @@ -43,81 +43,81 @@ [(abstract: String Text - [(def: (string value) - (-> Text String) - (:abstraction value)) + (def: (string value) + (-> Text String) + (:abstraction value)) - (def: (text value) - (-> String Text) - (:representation value))])] + (def: (text value) + (-> String Text) + (:representation value)))] ["Type-parameters are optional." (abstract: (Duplicate a) [a a] - [(def: (duplicate value) - (All (_ a) (-> a (Duplicate a))) - (:abstraction [value value]))])] + (def: (duplicate value) + (All (_ a) (-> a (Duplicate a))) + (:abstraction [value value])))] ["Definitions can be nested." (abstract: (Single a) a - [(def: (single value) - (All (_ a) (-> a (Single a))) - (:abstraction value)) + (def: (single value) + (All (_ a) (-> a (Single a))) + (:abstraction value)) - (abstract: (Double a) - [a a] + (abstract: (Double a) + [a a] - [(def: (double value) - (All (_ a) (-> a (Double a))) - (:abstraction [value value])) + (def: (double value) + (All (_ a) (-> a (Double a))) + (:abstraction [value value])) - (def: (single' value) - (All (_ a) (-> a (Single a))) - (:abstraction Single [value value])) + (def: (single' value) + (All (_ a) (-> a (Single a))) + (:abstraction Single [value value])) - (let [value 0123] - (same? value - (|> value - single' - (:representation Single) - double - :representation)))])])] + (let [value 0123] + (same? value + (|> value + single' + (:representation Single) + double + :representation)))))] ["Type-parameters do not necessarily have to be used in the representation type." "If they are not used, they become phantom types and can be used to customize types without changing the representation." (abstract: (JavaScript a) Text - [(abstract: Expression Any []) - (abstract: Statement Any []) + (abstract: Expression Any) + (abstract: Statement Any) - (def: (+ x y) - (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression)) - (:abstraction - (format "(" (:representation x) "+" (:representation y) ")"))) + (def: (+ x y) + (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression)) + (:abstraction + (format "(" (:representation x) "+" (:representation y) ")"))) - (def: (while test body) - (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement)) - (:abstraction - (format "while(" (:representation test) ") {" - (:representation body) - "}")))])]) + (def: (while test body) + (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement)) + (:abstraction + (format "while(" (:representation test) ") {" + (:representation body) + "}"))))]) (documentation: /.:transmutation "Transmutes an abstract/nominal type's phantom types." [(abstract: (JavaScript a) Text - [(abstract: Expression Any []) - (abstract: Statement Any []) + (abstract: Expression Any) + (abstract: Statement Any) - (def: (statement expression) - (-> (JavaScript Expression) (JavaScript Statement)) - (:transmutation expression)) + (def: (statement expression) + (-> (JavaScript Expression) (JavaScript Statement)) + (:transmutation expression)) - (def: (statement' expression) - (-> (JavaScript Expression) (JavaScript Statement)) - (:transmutation JavaScript expression))])]) + (def: (statement' expression) + (-> (JavaScript Expression) (JavaScript Statement)) + (:transmutation JavaScript expression)))]) (documentation: /.^:representation "Pattern-matching macro to easily extract a representation." -- cgit v1.2.3