Skip to content

Commit 51dfe6d

Browse files
committed
Fix: No longer forgetting module reservations.
1 parent feb7e17 commit 51dfe6d

File tree

4 files changed

+36
-47
lines changed

4 files changed

+36
-47
lines changed

stdlib/source/library/lux/compiler/meta/archive.lux

+7-12
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@
6969

7070
[[module_has_already_been_reserved]
7171
[module_must_be_reserved_before_it_can_be_added]
72-
[module_is_only_reserved]]
73-
)
72+
[module_is_only_reserved]])
7473

75-
(every .public (Entry a)
74+
(every .public (Entry it)
7675
(Record
77-
[#module (Module a)
76+
[#module (Module it)
7877
#output Output
7978
#registry Registry]))
8079

@@ -160,12 +159,10 @@
160159

161160
(the .public entries
162161
(-> Archive
163-
(List [descriptor.Module [module.ID (Entry Any)]]))
162+
(List [descriptor.Module [module.ID (Maybe (Entry Any))]]))
164163
(|>> nominal.as
165164
(its #resolver)
166-
dictionary.entries
167-
(list.all (function (_ [module [module_id entry]])
168-
(by maybe.monad each (|>> [module_id] [module]) entry)))))
165+
dictionary.entries))
169166

170167
(the .public (find module archive)
171168
(-> descriptor.Module Archive
@@ -276,10 +273,8 @@
276273
(let [(open "/[0]") (nominal.as archive)]
277274
(|> /#resolver
278275
dictionary.entries
279-
(list.all (function (_ [module [id descriptor+document]])
280-
(when descriptor+document
281-
{.#Some _} {.#Some [module id]}
282-
{.#None} {.#None})))
276+
(list#each (function (_ [module [id entry]])
277+
[module id]))
283278
[version configuration /#next]
284279
(\\injection.value ..as_binary))))
285280

stdlib/source/library/lux/compiler/meta/cache/dependency/artifact.lux

+13-8
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,19 @@
182182
(Dictionary unit.ID (Set unit.ID))])
183183
(|> archive
184184
archive.entries
185-
(list#each (function (_ [module [module_id [_module output registry]]])
186-
(|> registry
187-
registry.artifacts
188-
sequence.as_list
189-
(list#each (function (_ [artifact dependencies])
190-
[[module_id (its artifact.#id artifact)]
191-
(its artifact.#mandatory? artifact)
192-
dependencies])))))
185+
(list#each (function (_ [module [module_id entry]])
186+
(when entry
187+
{.#Some [_module output registry]}
188+
(|> registry
189+
registry.artifacts
190+
sequence.as_list
191+
(list#each (function (_ [artifact dependencies])
192+
[[module_id (its artifact.#id artifact)]
193+
(its artifact.#mandatory? artifact)
194+
dependencies])))
195+
196+
{.#None}
197+
(list))))
193198
list#conjoint
194199
(list#mix (function (_ [artifact_id mandatory? dependencies]
195200
[mandatory_dependencies

stdlib/source/library/lux/compiler/program.lux

+5-15
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,6 @@
246246
(its context.#host context)
247247
file/extension.tape_archive))
248248

249-
(the (cached_file_path fs full_path)
250-
(-> (file.System Future) file.Path
251-
[file.Path file.Path])
252-
(<| maybe.trusted
253-
(monad.let maybe.monad
254-
[.let [/ (by fs delimiter)]
255-
@ (text.last_index / full_path)
256-
[directory file] (text.split_at @ full_path)]
257-
(pure [directory (text.replaced_once / "" file)]))))
258-
259249
(expansion.let [<parameters> (these anchor expression artifact)]
260250
(these (the (load_cache! host_fs cache_fs context)
261251
(-> (file.System Future) (file.System Future) Context
@@ -296,13 +286,13 @@
296286
(cache_path original_fs context)
297287
(by tar.binary as cache))))
298288

299-
(the (with_caching it)
289+
(the (with_cache it)
300290
(for_any (_ <parameters>)
301291
(-> (Platform <parameters>)
302292
[(file.System Future) (Platform <parameters>)]))
303-
(let [cache_fs (file.memory (by (its platform.#file_system it) delimiter))
304-
it (revised platform.#file_system (hybrid_fs cache_fs) it)]
305-
[cache_fs it]))
293+
(let [cache_fs (file.memory (by (its platform.#file_system it) delimiter))]
294+
[cache_fs
295+
(revised platform.#file_system (hybrid_fs cache_fs) it)]))
306296

307297
(the (enable_output! original_fs context)
308298
(-> (file.System Future) Context
@@ -339,7 +329,7 @@
339329
..timed
340330
(monad.let [! (try.with !)]
341331
[.let [original_fs (its platform.#file_system platform)
342-
[cache_fs platform] (with_caching platform)]
332+
[cache_fs platform] (with_cache platform)]
343333
_ (enable_output! original_fs file_context)
344334
_ (load_cache! original_fs cache_fs file_context)
345335
import (import.import (its platform.#file_system platform) (its cli.#libraries compilation))

stdlib/source/library/lux/concurrency/stm.lux

+11-12
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,25 @@
222222
Tx
223223
(stack))
224224

225-
(every (Commit it)
226-
[(STM it)
227-
(Future it)
228-
(Resolver it)])
225+
(every Commit
226+
(for_some (_ it)
227+
[(STM it)
228+
(Future it)
229+
(Resolver it)]))
229230

230231
(the pending_commits
231232
(Atom (Rec Commits
232-
[(Future [(for_some (_ it) (Commit it)) Commits])
233-
(Resolver [(for_some (_ it) (Commit it)) Commits])]))
233+
[(Future [Commit Commits])
234+
(Resolver [Commit Commits])]))
234235
(atom (future.future [])))
235236

236237
(the commit_processor_flag
237238
(Atom Bit)
238239
(atom false))
239240

240241
(the (issue_commit! commit)
241-
(for_any (_ it)
242-
(-> (Commit it)
243-
(IO Any)))
242+
(-> Commit
243+
(IO Any))
244244
(let [entry [commit (future.future [])]]
245245
(monad.let [! io.monad]
246246
[|commits|&resolve (atom.read! pending_commits)]
@@ -259,9 +259,8 @@
259259
(again tail)))))))
260260

261261
(the (process_commit! commit)
262-
(for_any (_ it)
263-
(-> (Commit it)
264-
(IO Any)))
262+
(-> Commit
263+
(IO Any))
265264
(let [[stm_proc output resolve] commit
266265
[finished_tx value] (stm_proc fresh_tx)]
267266
(if (can_commit? finished_tx)

0 commit comments

Comments
 (0)