Skip to content

Commit 02aa5b3

Browse files
committed
Clean-up of adaptation functions.
1 parent 7d5e327 commit 02aa5b3

File tree

14 files changed

+58
-171
lines changed

14 files changed

+58
-171
lines changed

stdlib/source/library/lux/compiler/default/platform.lux

+2-2
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,9 @@
772772
phase.export
773773
(phase.value analysis_state)
774774
future#pure)]
775-
(future#pure (if (check.< ..Custom (@type.old_type /#type))
775+
(future#pure (if (check.< ..Custom (@type.old /#type))
776776
{try.#Success [context (its compiler.#parameters it) /#value]}
777-
(exception.except ..invalid_custom_compiler [/#definition (@type.old_type /#type)]))))))
777+
(exception.except ..invalid_custom_compiler [/#definition (@type.old /#type)]))))))
778778

779779
(the .public (compile program global lux_compiler phase_wrapper import file_context extender expander platform compilation context
780780
all_extensions)

stdlib/source/library/lux/compiler/language/lux/analysis/evaluation.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
Eval))
6060
(function (eval archive type exprC)
6161
(<| (monad.let phase.monad
62-
[exprA (<| (//type.with (@type.old_type type))
62+
[exprA (<| (//type.with (@type.old type))
6363
//scope.reset
6464
(analysis archive exprC))
6565
module phase.name_of_current_module

stdlib/source/library/lux/compiler/language/lux/analysis/inference.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
(monad.let phase.monad
135135
[:ex: /type.existential]
136136
(general archive analysis
137-
(maybe.trusted (type.reified (list (@type.old_type :ex:)) morphism))
137+
(maybe.trusted (type.reified (list (@type.old :ex:)) morphism))
138138
args))
139139

140140
{.#Reification inputT transT}

stdlib/source/library/lux/compiler/language/lux/analysis/scope.lux

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
(stack.reversed inner))
115115
scopes (stack#composite inner' outer)]
116116
{.#Right [(has @type.#scopes scopes state)
117-
{.#Some [(@type.old_type ref_type) ref]}]})
117+
{.#Some [(@type.old ref_type) ref]}]})
118118
))))
119119

120120
(exception.the .public no_scope)
@@ -132,7 +132,7 @@
132132
new_head (revised @type.#locals
133133
(is (Change Local)
134134
(|>> (revised @type.#counter ++)
135-
(revised @type.#mappings (property.has name [(@type.new_type type) new_var_id]))))
135+
(revised @type.#mappings (property.has name [(@type.new type) new_var_id]))))
136136
head)]
137137
(when (phase.value' (has @type.#scopes {.#Top new_head tail} state)
138138
action)

stdlib/source/library/lux/compiler/language/lux/analysis/type.lux

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
(-> (Check it)
3636
(Operation it)))
3737
(function (_ state)
38-
(when (action (@type.old_type_context (its @type.#type_context state)))
38+
(when (action (@type.old_context (its @type.#type_context state)))
3939
{try.#Success [context' output]}
40-
{try.#Success [(has @type.#type_context (@type.new_type_context context') state)
40+
{try.#Success [(has @type.#type_context (@type.new_context context') state)
4141
output]}
4242

4343
{try.#Failure error}
@@ -73,21 +73,21 @@
7373
(Change (Operation it))))
7474
(phase.localized (its @type.#expected)
7575
(has @type.#expected)
76-
(function.constant {.#Some (@type.new_type expected)})))
76+
(function.constant {.#Some (@type.new expected)})))
7777

7878
(the .public fresh
7979
(for_any (_ it)
8080
(Change (Operation it)))
8181
(phase.localized (its @type.#type_context)
8282
(has @type.#type_context)
83-
(function.constant (@type.new_type_context check.fresh_context))))
83+
(function.constant (@type.new_context check.fresh_context))))
8484

8585
(the .public (inference actualT)
8686
(-> .Type
8787
(Operation Any))
8888
(monad.let phase.monad
8989
[expectedT /.expected_type]
90-
(..check (check.check (@type.old_type expectedT) actualT))))
90+
(..check (check.check (@type.old expectedT) actualT))))
9191

9292
(the .public (with_var it)
9393
(for_any (_ it)

stdlib/source/library/lux/compiler/language/lux/phase.lux

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
(when (property.value (name.proper it) (its @type.#definitions module))
302302
{try.#Success [exported? {@type.#Definition [def_type expression_of_definition def_value]}]}
303303
(if (visible? exported? (name.module it) this_module_name)
304-
(if (type.= ,type (@type.old_type def_type))
304+
(if (type.= ,type (@type.old def_type))
305305
(pure (as (-> Any @type.Label) def_value))
306306
(..of_try (exception.except ,not_a [it])))
307307
(..of_try (exception.except ,cannot_access [it this_module_name])))
@@ -415,7 +415,7 @@
415415
(macro de_aliased)
416416

417417
{@type.#Definition [def_type expression_of_definition def_value]}
418-
(if (type.= @type.Macro (@type.old_type def_type))
418+
(if (type.= @type.Macro (@type.old def_type))
419419
{try.#Success [lux (as (-> Any @type.Macro) def_value)]}
420420
{try.#Failure binding.not_a_macro})))))))))
421421

stdlib/source/library/lux/compiler/language/lux/phase/analysis/complex.lux

+7-7
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
(function (again valueC)
122122
(monad.let [! phase.monad]
123123
[expectedT /.expected_type
124-
.let [expectedT (@type.old_type expectedT)]
124+
.let [expectedT (@type.old expectedT)]
125125
expectedT' (/type.check (check.clean (list) expectedT))
126126
@ /.provenance
127127
here phase.name_of_current_module]
@@ -200,11 +200,11 @@
200200
{.#None}
201201
[0 false]))
202202
expectedT /.expected_type
203-
.let [expectedT (@type.old_type expectedT)]]
203+
.let [expectedT (@type.old expectedT)]]
204204
(when expectedT
205205
{.#Variable .general _}
206206
(monad.let !
207-
[inferenceT (/inference.variant lefts right? (@type.old_type variantT))
207+
[inferenceT (/inference.variant lefts right? (@type.old variantT))
208208
[inferredT valueA+] (/inference.general archive analyse inferenceT (stack valueC))
209209
@ /.provenance]
210210
(pure (/.variant @ [lefts right? (|> valueA+ stack.top try.trusted)])))
@@ -256,7 +256,7 @@
256256
(Operation /.Term))
257257
(monad.let [! phase.monad]
258258
[expectedT /.expected_type
259-
.let [expectedT (@type.old_type expectedT)]
259+
.let [expectedT (@type.old expectedT)]
260260
here phase.name_of_current_module]
261261
(/.with_exception ..cannot_analyse_tuple [here expectedT membersC]
262262
(when expectedT
@@ -362,7 +362,7 @@
362362
(the (slot_type [[_ it] _])
363363
(-> [@type.Label @type.Code]
364364
Type)
365-
(@type.old_type it))
365+
(@type.old it))
366366

367367
(the (same_record? it)
368368
(Predicate (Stack [@type.Label @type.Code]))
@@ -434,7 +434,7 @@
434434
[[[_ :record:] _] (stack.top record)]
435435
(pure [(stack.size record)
436436
(stack#each product.right record)
437-
(@type.old_type :record:)])))))
437+
(@type.old :record:)])))))
438438

439439
{try.#Failure error}
440440
(pure {.#None}))))
@@ -504,7 +504,7 @@
504504
{.#Some [record_size membersC recordT]}
505505
(monad.let !
506506
[expectedT /.expected_type
507-
.let [expectedT (@type.old_type expectedT)]]
507+
.let [expectedT (@type.old expectedT)]]
508508
(when expectedT
509509
{.#Variable .general _}
510510
(monad.let !

stdlib/source/library/lux/compiler/language/lux/phase/analysis/function.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
Phase)
6565
(monad.let [! phase.monad]
6666
[functionT /.expected_type
67-
.let [functionT (@type.old_type functionT)]
67+
.let [functionT (@type.old functionT)]
6868
here phase.name_of_current_module]
6969
(loop (again [expectedT functionT])
7070
(/.with_exception ..cannot_analyse [here expectedT function_name arg_name body]

stdlib/source/library/lux/compiler/language/lux/phase/analysis/when.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@
489489

490490
{.#None}
491491
[0 false]))
492-
_ (/type.check (check.check :input: (@type.old_type variantT)))]
492+
_ (/type.check (check.check :input: (@type.old variantT)))]
493493
(pattern_analysis :input:
494494
(code.variant (.list (code.natural lefts)
495495
(code.bit right?)

stdlib/source/library/lux/compiler/language/lux/phase/extension.lux

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@
127127
(Operation @type.Lux Value))
128128
(monad.let phase.monad
129129
[[actual_type value] (global_value name)]
130-
(if (check.< expected_type (@type.old_type actual_type))
130+
(if (check.< expected_type (@type.old actual_type))
131131
(pure value)
132-
(phase.except ..invalid [name expected_type (@type.old_type actual_type)]))))
132+
(phase.except ..invalid [name expected_type (@type.old actual_type)]))))
133133

134134
(the .public (reification extender
135135
lux phase archive

stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/jvm.lux

+3-3
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@
565565
[lengthA (<| (typeA.with ..int)
566566
(analyse archive lengthC))
567567
expectedT analysis.expected_type
568-
.let [expectedT (@type.old_type expectedT)]
568+
.let [expectedT (@type.old expectedT)]
569569
expectedJT (jvm_array_type expectedT)
570570
elementJT (when (projection.array? expectedJT)
571571
{.#Some elementJT}
@@ -871,7 +871,7 @@
871871
(function (_ extension_name analyse archive [])
872872
(monad.let phase.monad
873873
[expectedT analysis.expected_type
874-
.let [expectedT (@type.old_type expectedT)]
874+
.let [expectedT (@type.old expectedT)]
875875
[_ :object:] (check_object expectedT)
876876
_ (typeA.inference :object:)
877877
@ analysis.provenance]
@@ -997,7 +997,7 @@
997997
(function (_ extension_name analyse archive [fromC])
998998
(monad.let [! phase.monad]
999999
[toT analysis.expected_type
1000-
.let [toT (@type.old_type toT)]
1000+
.let [toT (@type.old toT)]
10011001
toJT (check_jvm toT)
10021002
[fromT fromA] (typeA.inferring
10031003
(analyse archive fromC))

stdlib/source/library/lux/compiler/language/lux/phase/extension/analysis/lux.lux

+9-9
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
[input (<| (typeA.with @type.Character)
173173
(analysis archive input))
174174
expectedT analysis.expected_type
175-
.let [expectedT (@type.old_type expectedT)]
175+
.let [expectedT (@type.old expectedT)]
176176
conditionals (list.each' ! (.function (_ [cases branch])
177177
(<| (by ! each (|>> [cases]))
178178
(typeA.with expectedT)
@@ -221,7 +221,7 @@
221221
[(?.and ?list.any ?list.any)
222222
(.function (_ extension_name analysis archive [module 'expression])
223223
(monad.let [! phase.monad]
224-
[module (eval archive (@type.new_type @type.Text) module)]
224+
[module (eval archive (@type.new @type.Text) module)]
225225
(analysis.with_current_module (as (-> Any Text) module)
226226
(analysis archive (code.with [(as (-> Any Text) module) 0 0] 'expression)))))]))
227227

@@ -233,9 +233,9 @@
233233
(.function (_ extension_name analysis archive [typeC valueC])
234234
(monad.let [! phase.monad]
235235
[actualT (by ! each (|>> (as (-> Any @type.Type)))
236-
(eval archive (@type.new_type @type.Type) typeC))
237-
_ (typeA.inference (@type.old_type actualT))]
238-
(<| (typeA.with (@type.old_type actualT))
236+
(eval archive (@type.new @type.Type) typeC))
237+
_ (typeA.inference (@type.old actualT))]
238+
(<| (typeA.with (@type.old actualT))
239239
(analysis archive valueC))))]))
240240

241241
(the .public (as#_extension eval)
@@ -245,8 +245,8 @@
245245
[(?.and ?list.any ?list.any)
246246
(.function (_ extension_name analysis archive [typeC it])
247247
(monad.let [! phase.monad]
248-
[coercion (eval archive (@type.new_type @type.Type) typeC)
249-
[actual_type it] (inference.general archive analysis (@type.old_type (as (-> Any @type.Type) coercion)) (stack it))
248+
[coercion (eval archive (@type.new @type.Type) typeC)
249+
[actual_type it] (inference.general archive analysis (@type.old (as (-> Any @type.Type) coercion)) (stack it))
250250
_ (typeA.inference actual_type)]
251251
(.when it
252252
(stack it)
@@ -301,12 +301,12 @@
301301
... the exception, and know that the default it was looking for has the correct type, because
302302
... the exception is only ever raised _after_ the inference.
303303
(monad.let !
304-
[_ (typeA.inference (@type.old_type type))]
304+
[_ (typeA.inference (@type.old type))]
305305
(analysis.except ///.defaults_cannot_be_referenced [def_name]))
306306

307307
else
308308
(monad.let !
309-
[_ (typeA.inference (@type.old_type type))
309+
[_ (typeA.inference (@type.old type))
310310
@ analysis.provenance]
311311
(pure (analysis.constant @ def_name)))))
312312
(analysis.except ..cannot_access_global [expected def_name])))))]))

stdlib/source/library/lux/compiler/language/lux/phase/extension/declaration/lux.lux

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
[type valueT value] (..definition archive full_name valueC)
224224
[_ _ exported?] (evaluate! archive @type.Bit exported?C)
225225
_ (<| /////declaration.of_analysis
226-
(module.define short_name [(as (-> Any Bit) exported?) {@type.#Definition [(@type.new_type type) {.#None} value]}]))]
226+
(module.define short_name [(as (-> Any Bit) exported?) {@type.#Definition [(@type.new type) {.#None} value]}]))]
227227
(pure /////declaration.no_requirements))))]))
228228

229229
(the imports

0 commit comments

Comments
 (0)