Rework module system
All checks were successful
Test, Build, and Release / test (push) Successful in 1m37s
Test, Build, and Release / build (push) Successful in 1m14s

Don't require/allow naming a module, instead require that the importer
names it. Allow importing into the local scope with the name !Local.
Simplify namespacing logic. Updates all tests to reflect these changes.
This commit is contained in:
2025-01-30 13:56:09 -06:00
parent 09eedfb609
commit bf1000d174
34 changed files with 218 additions and 239 deletions

View File

@ -1,24 +1,22 @@
!module Size
!import "lib/base.tri" Lib
!import "lib/base.tri" !Local
main = size size
compose = \f g x : f (g x)
succ = Lib.y (\self :
Lib.triage
succ = y (\self :
triage
1
t
(Lib.triage
(triage
(t (t t))
(\_ Lib.tail : t t (self Lib.tail))
(\_ tail : t t (self tail))
t))
size = (\x :
(Lib.y (\self x :
(y (\self x :
compose succ
(Lib.triage
(triage
(\x : x)
self
(\x y : compose (self x) (self y))