From 75e8244fd7914d2ac0c3622d2277b84c4bfa7ffb Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 4 Jun 2022 20:00:01 -0400 Subject: comonad/cofree => comonad/free --- stdlib/source/library/lux.lux | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index cdcb304a0..1c550ec22 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -4264,11 +4264,20 @@ _ (failure (..wrong_syntax_error (symbol ..refer))))) +(macro: .public (with tokens) + (case (..parsed (..andP ..anyP ..anyP) + tokens) + {.#Some [implementation expression]} + (meta#in (list (` (..let [(..open (~ (text$ (alias_stand_in 0)))) (~ implementation)] + (~ expression))))) + + {.#None} + (failure (..wrong_syntax_error (symbol ..with))))) + (macro: .public (at tokens) (case tokens - (pattern (list struct [_ {#Symbol member}])) - (meta#in (list (` (..let [(..open (~ (text$ (alias_stand_in 0)))) (~ struct)] - (~ (symbol$ member)))))) + (pattern (list implementation [_ {#Symbol member}])) + (meta#in (list (` (..with (~ implementation) (~ (symbol$ member)))))) (pattern (partial_list struct member args)) (meta#in (list (` ((..at (~ struct) (~ member)) (~+ args))))) -- cgit v1.2.3