aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/thunk.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/control/thunk.lux')
-rw-r--r--stdlib/source/lux/control/thunk.lux33
1 files changed, 0 insertions, 33 deletions
diff --git a/stdlib/source/lux/control/thunk.lux b/stdlib/source/lux/control/thunk.lux
deleted file mode 100644
index a78f78023..000000000
--- a/stdlib/source/lux/control/thunk.lux
+++ /dev/null
@@ -1,33 +0,0 @@
-(;module:
- lux
- (lux [io]
- (control monad)
- (concurrency ["A" atom])
- [macro]
- (macro ["s" syntax #+ syntax:])))
-
-(type: #export (Thunk a)
- (-> [] a))
-
-(def: #hidden (freeze' generator)
- (All [a] (-> (-> [] a) (-> [] a)))
- (let [cache (: (A;Atom (Maybe ($ +0)))
- (A;atom #;None))]
- (function [_]
- (case (io;run (A;get cache))
- (#;Some value)
- value
-
- _
- (let [value (generator [])]
- (exec (io;run (A;compare-and-swap _ (#;Some value) cache))
- value))))))
-
-(syntax: #export (freeze expr)
- (do @
- [g!arg (macro;gensym "")]
- (wrap (list (` (freeze' (function [(~ g!arg)] (~ expr))))))))
-
-(def: #export (thaw thunk)
- (All [a] (-> (Thunk a) a))
- (thunk []))