diff options
Diffstat (limited to 'stdlib/source/library/lux/control/lazy.lux')
-rw-r--r-- | stdlib/source/library/lux/control/lazy.lux | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 9e59da7dc..8d3c877d8 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -1,28 +1,33 @@ (.using - [library - [lux "*" - [abstract - [functor {"+" Functor}] - [apply {"+" Apply}] - [monad {"+" Monad do}] - [equivalence {"+" Equivalence}]] - [control - ["[0]" io] - [parser - ["<[0]>" code]] - [concurrency - ["[0]" atom]]] - [macro {"+" with_symbols} - [syntax {"+" syntax:}]] - [type - abstract]]]) + [library + [lux "*" + [abstract + [functor {"+" Functor}] + [apply {"+" Apply}] + [monad {"+" Monad do}] + [equivalence {"+" Equivalence}]] + [control + ["[0]" io] + [parser + ["<[0]>" code]] + [concurrency + ["[0]" atom]]] + [macro {"+" with_symbols} + [syntax {"+" syntax:}]] + [type {"+" :sharing} + abstract]]]) (abstract: .public (Lazy a) (-> [] a) (def: (lazy' generator) (All (_ a) (-> (-> [] a) (Lazy a))) - (let [cache (atom.atom {.#None})] + (let [cache (atom.atom (:sharing [a] + (-> [] a) + generator + + (Maybe a) + {.#None}))] (:abstraction (function (_ _) (case (io.run! (atom.read! cache)) {.#Some value} |