diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/lazy.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index 75b5e29e2..27c60afa9 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -7,23 +7,23 @@ (concurrency [atom]) [macro] (macro ["s" syntax #+ syntax:]) - (type opaque))) + (type abstract))) -(opaque: #export (Lazy a) +(abstract: #export (Lazy a) (-> [] a) (def: #hidden (freeze' generator) (All [a] (-> (-> [] a) (Lazy a))) (let [cache (atom.atom (: (Maybe ($ +0)) #.None))] - (@opaque (function [_] - (case (io.run (atom.read cache)) - (#.Some value) - value - - _ - (let [value (generator [])] - (exec (io.run (atom.compare-and-swap _ (#.Some value) cache)) - value))))))) + (@abstract (function [_] + (case (io.run (atom.read cache)) + (#.Some value) + value + + _ + (let [value (generator [])] + (exec (io.run (atom.compare-and-swap _ (#.Some value) cache)) + value))))))) (def: #export (thaw l-value) (All [a] (-> (Lazy a) a)) |