aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/language
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/language')
-rw-r--r--stdlib/source/lux/language/compiler.lux9
-rw-r--r--stdlib/source/lux/language/compiler/analysis.lux13
-rw-r--r--stdlib/source/lux/language/compiler/analysis/case.lux23
-rw-r--r--stdlib/source/lux/language/compiler/analysis/case/coverage.lux25
-rw-r--r--stdlib/source/lux/language/compiler/analysis/expression.lux23
-rw-r--r--stdlib/source/lux/language/compiler/analysis/function.lux16
-rw-r--r--stdlib/source/lux/language/compiler/analysis/inference.lux13
-rw-r--r--stdlib/source/lux/language/compiler/analysis/module.lux106
-rw-r--r--stdlib/source/lux/language/compiler/analysis/primitive.lux6
-rw-r--r--stdlib/source/lux/language/compiler/analysis/reference.lux13
-rw-r--r--stdlib/source/lux/language/compiler/analysis/scope.lux19
-rw-r--r--stdlib/source/lux/language/compiler/analysis/structure.lux26
-rw-r--r--stdlib/source/lux/language/compiler/analysis/type.lux11
-rw-r--r--stdlib/source/lux/language/compiler/default/cache.lux26
-rw-r--r--stdlib/source/lux/language/compiler/default/repl/type.lux14
-rw-r--r--stdlib/source/lux/language/compiler/extension.lux11
-rw-r--r--stdlib/source/lux/language/compiler/extension/analysis.lux6
-rw-r--r--stdlib/source/lux/language/compiler/extension/analysis/common.lux51
-rw-r--r--stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux24
-rw-r--r--stdlib/source/lux/language/compiler/extension/bundle.lux10
-rw-r--r--stdlib/source/lux/language/compiler/init.lux22
-rw-r--r--stdlib/source/lux/language/compiler/meta/archive.lux22
-rw-r--r--stdlib/source/lux/language/compiler/meta/cache.lux28
-rw-r--r--stdlib/source/lux/language/compiler/meta/cache/dependency.lux2
-rw-r--r--stdlib/source/lux/language/compiler/meta/io/archive.lux8
-rw-r--r--stdlib/source/lux/language/compiler/meta/io/context.lux29
-rw-r--r--stdlib/source/lux/language/compiler/synthesis.lux9
-rw-r--r--stdlib/source/lux/language/compiler/synthesis/case.lux15
-rw-r--r--stdlib/source/lux/language/compiler/synthesis/expression.lux18
-rw-r--r--stdlib/source/lux/language/compiler/synthesis/function.lux20
-rw-r--r--stdlib/source/lux/language/compiler/synthesis/loop.lux19
-rw-r--r--stdlib/source/lux/language/compiler/translation.lux18
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux52
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux19
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux43
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux394
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux11
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux50
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux29
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux5
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux16
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux23
-rw-r--r--stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux26
-rw-r--r--stdlib/source/lux/language/host/scheme.lux7
-rw-r--r--stdlib/source/lux/language/name.lux2
-rw-r--r--stdlib/source/lux/language/syntax.lux8
-rw-r--r--stdlib/source/lux/language/type.lux12
-rw-r--r--stdlib/source/lux/language/type/check.lux17
48 files changed, 692 insertions, 677 deletions
diff --git a/stdlib/source/lux/language/compiler.lux b/stdlib/source/lux/language/compiler.lux
index e714773b7..03dd30e2a 100644
--- a/stdlib/source/lux/language/compiler.lux
+++ b/stdlib/source/lux/language/compiler.lux
@@ -1,15 +1,16 @@
(.module:
[lux #*
[control
- [state]
+ ["." state]
["ex" exception (#+ Exception exception:)]
[monad (#+ do)]]
[data
- [product]
- [error (#+ Error)]
+ ["." product]
+ ["." error (#+ Error)]
["." text
format]]
- [macro ["s" syntax (#+ syntax:)]]])
+ [macro
+ ["s" syntax (#+ syntax:)]]])
(type: #export (Operation s o)
(state.State' Error s o))
diff --git a/stdlib/source/lux/language/compiler/analysis.lux b/stdlib/source/lux/language/compiler/analysis.lux
index a2686d6bf..3c4a646fe 100644
--- a/stdlib/source/lux/language/compiler/analysis.lux
+++ b/stdlib/source/lux/language/compiler/analysis.lux
@@ -1,15 +1,16 @@
(.module:
[lux (#- nat int rev)
[data
- [product]
- [error]
+ ["." product]
+ ["." error]
[text ("text/" Equivalence<Text>)]
- [collection [list ("list/" Fold<List>)]]]
- [function]]
+ [collection
+ ["." list ("list/" Fold<List>)]]]
+ ["." function]]
[//
- [extension (#+ Extension)]
+ ["." extension (#+ Extension)]
[//
- [reference (#+ Register Variable Reference)]]])
+ ["." reference (#+ Register Variable Reference)]]])
(type: #export #rec Primitive
#Unit
diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux
index 2f5162fbd..34a2b38d6 100644
--- a/stdlib/source/lux/language/compiler/analysis/case.lux
+++ b/stdlib/source/lux/language/compiler/analysis/case.lux
@@ -1,28 +1,29 @@
(.module:
[lux (#- case)
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
- [product]
- [error]
- [maybe]
+ ["." product]
+ ["." error]
+ ["." maybe]
[text
format]
- [collection [list ("list/" Fold<List> Monoid<List> Functor<List>)]]]
+ [collection
+ ["." list ("list/" Fold<List> Monoid<List> Functor<List>)]]]
["." macro
- [code]]]
- [// (#+ Pattern Analysis Operation Compiler)
- [scope]
+ ["." code]]]
+ ["." // (#+ Pattern Analysis Operation Compiler)
+ ["." scope]
["//." type]
- [structure]
+ ["." structure]
["/." //
- [extension]
+ ["." extension]
[//
["." type
["tc" check]]]]]
[/
- [coverage]])
+ ["." coverage]])
(exception: #export (cannot-match-type-with-pattern {type Type} {pattern Code})
(ex.report ["Type" (%type type)]
diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux
index c19003df6..5c3ff1d72 100644
--- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux
+++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux
@@ -1,20 +1,21 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]
equivalence]
[data
[bit ("bit/" Equivalence<Bit>)]
- [number]
+ ["." number]
["e" error ("error/" Monad<Error>)]
- [maybe]
- [text format]
+ ["." maybe]
+ [text
+ format]
[collection
- [list ("list/" Fold<List>)]
+ ["." list ("list/" Fold<List>)]
["dict" dictionary (#+ Dictionary)]]]]
- [//// ("operation/" Monad<Operation>)]
- [/// (#+ Pattern Variant Operation)])
+ ["." //// ("operation/" Monad<Operation>)]
+ ["." /// (#+ Pattern Variant Operation)])
(def: cases
(-> (Maybe Nat) Nat)
@@ -174,7 +175,7 @@
_
#0)))
-(open: "C/" Equivalence<Coverage>)
+(open: "coverage/" Equivalence<Coverage>)
## After determining the coverage of each individual pattern, it is
## necessary to merge them all to figure out if the entire
@@ -226,7 +227,7 @@
(#Variant allSF casesM)))))
[(#Seq leftA rightA) (#Seq leftSF rightSF)]
- (case [(C/= leftSF leftA) (C/= rightSF rightA)]
+ (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)]
## There is nothing the addition adds to the coverage.
[#1 #1]
redundant-pattern
@@ -254,12 +255,12 @@
## The left part will always match, so the addition is redundant.
(^multi [(#Seq left right) single]
- (C/= left single))
+ (coverage/= left single))
redundant-pattern
## The right part is not necessary, since it can always match the left.
(^multi [single (#Seq left right)]
- (C/= left single))
+ (coverage/= left single))
(error/wrap single)
## When merging a new coverage against one based on Alt, it may be
@@ -317,7 +318,7 @@
(undefined)))))
_
- (if (C/= so-far addition)
+ (if (coverage/= so-far addition)
## The addition cannot possibly improve the coverage.
redundant-pattern
## There are now 2 alternative paths.
diff --git a/stdlib/source/lux/language/compiler/analysis/expression.lux b/stdlib/source/lux/language/compiler/analysis/expression.lux
index f413b8077..1c74499ad 100644
--- a/stdlib/source/lux/language/compiler/analysis/expression.lux
+++ b/stdlib/source/lux/language/compiler/analysis/expression.lux
@@ -5,20 +5,19 @@
["ex" exception (#+ exception:)]]
[data
["e" error]
- [product]
[text
format]]
- [macro]]
- ["." ///
- [extension]]
- [// (#+ Analysis Operation Compiler)
- [type]
- [primitive]
- [structure]
- [reference]
- ["/." /// (#+ Eval)
- ## [".L" macro]
- ]])
+ ["." macro]]
+ ["." // (#+ Analysis Operation Compiler)
+ ["." type]
+ ["." primitive]
+ ["." structure]
+ ["." reference]
+ ["/." //
+ ["." extension]
+ ["//." // (#+ Eval)
+ ## [".L" macro]
+ ]]])
(exception: #export (macro-expansion-failed {message Text})
message)
diff --git a/stdlib/source/lux/language/compiler/analysis/function.lux b/stdlib/source/lux/language/compiler/analysis/function.lux
index 51f1892de..440c49237 100644
--- a/stdlib/source/lux/language/compiler/analysis/function.lux
+++ b/stdlib/source/lux/language/compiler/analysis/function.lux
@@ -4,21 +4,21 @@
monad
["ex" exception (#+ exception:)]]
[data
- [maybe]
+ ["." maybe]
["." text
format]
- [collection [list ("list/" Fold<List> Monoid<List> Monad<List>)]]]
- ["." macro
- [code]]
+ [collection
+ ["." list ("list/" Fold<List> Monoid<List> Monad<List>)]]]
+ ["." macro]
[language
["." type
["tc" check]]]]
- [// (#+ Analysis Operation Compiler)
- [scope]
+ ["." // (#+ Analysis Operation Compiler)
+ ["." scope]
["//." type]
- [inference]
+ ["." inference]
["/." //
- [extension]]])
+ ["." extension]]])
(exception: #export (cannot-analyse {expected Type} {function Text} {argument Text} {body Code})
(ex.report ["Type" (%type expected)]
diff --git a/stdlib/source/lux/language/compiler/analysis/inference.lux b/stdlib/source/lux/language/compiler/analysis/inference.lux
index 403ad0092..29084ce40 100644
--- a/stdlib/source/lux/language/compiler/analysis/inference.lux
+++ b/stdlib/source/lux/language/compiler/analysis/inference.lux
@@ -4,18 +4,19 @@
[monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
- [maybe]
+ ["." maybe]
["." text
format]
- [collection [list ("list/" Functor<List>)]]]
- [macro]]
+ [collection
+ ["." list ("list/" Functor<List>)]]]
+ ["." macro]]
[////
["." type
["tc" check]]]
- [/// ("operation/" Monad<Operation>)
- [extension]]
+ ["." /// ("operation/" Monad<Operation>)
+ ["." extension]]
[// (#+ Tag Analysis Operation Compiler)]
- [//type])
+ ["." //type])
(exception: #export (variant-tag-out-of-bounds {size Nat} {tag Tag} {type Type})
(ex.report ["Tag" (%n tag)]
diff --git a/stdlib/source/lux/language/compiler/analysis/module.lux b/stdlib/source/lux/language/compiler/analysis/module.lux
index 1ac2b4ac4..7c21724bb 100644
--- a/stdlib/source/lux/language/compiler/analysis/module.lux
+++ b/stdlib/source/lux/language/compiler/analysis/module.lux
@@ -1,21 +1,21 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]
pipe]
[data
- [text ("text/" Equivalence<Text>)
+ ["." text ("text/" Equivalence<Text>)
format]
- ["e" error]
+ ["." error]
[collection
- [list ("list/" Fold<List> Functor<List>)]
+ ["." list ("list/" Fold<List> Functor<List>)]
[dictionary
- [plist]]]]
- [macro]]
- [// (#+ Operation)
+ ["." plist]]]]
+ ["." macro]]
+ ["." // (#+ Operation)
["/." //
- [extension]]])
+ ["." extension]]])
(type: #export Tag Text)
@@ -70,10 +70,10 @@
#.None
(extension.lift
(function (_ state)
- (#e.Success [(update@ #.modules
- (plist.put self-name (set@ #.module-annotations (#.Some annotations) self))
- state)
- []])))
+ (#error.Success [(update@ #.modules
+ (plist.put self-name (set@ #.module-annotations (#.Some annotations) self))
+ state)
+ []])))
(#.Some old)
(///.throw cannot-set-module-annotations-more-than-once [self-name old annotations]))))
@@ -84,10 +84,10 @@
[self-name (extension.lift macro.current-module-name)]
(extension.lift
(function (_ state)
- (#e.Success [(update@ #.modules
- (plist.update self-name (update@ #.imports (|>> (#.Cons module))))
- state)
- []])))))
+ (#error.Success [(update@ #.modules
+ (plist.update self-name (update@ #.imports (|>> (#.Cons module))))
+ state)
+ []])))))
(def: #export (alias alias module)
(-> Text Text (Operation Any))
@@ -95,11 +95,11 @@
[self-name (extension.lift macro.current-module-name)]
(extension.lift
(function (_ state)
- (#e.Success [(update@ #.modules
- (plist.update self-name (update@ #.module-aliases (: (-> (List [Text Text]) (List [Text Text]))
- (|>> (#.Cons [alias module])))))
- state)
- []])))))
+ (#error.Success [(update@ #.modules
+ (plist.update self-name (update@ #.module-aliases (: (-> (List [Text Text]) (List [Text Text]))
+ (|>> (#.Cons [alias module])))))
+ state)
+ []])))))
(def: #export (exists? module)
(-> Text (Operation Bit))
@@ -109,7 +109,7 @@
(get@ #.modules)
(plist.get module)
(case> (#.Some _) #1 #.None #0)
- [state] #e.Success))))
+ [state] #error.Success))))
(def: #export (define name definition)
(-> Text Definition (Operation []))
@@ -120,14 +120,14 @@
(function (_ state)
(case (plist.get name (get@ #.definitions self))
#.None
- (#e.Success [(update@ #.modules
- (plist.put self-name
- (update@ #.definitions
- (: (-> (List [Text Definition]) (List [Text Definition]))
- (|>> (#.Cons [name definition])))
- self))
- state)
- []])
+ (#error.Success [(update@ #.modules
+ (plist.put self-name
+ (update@ #.definitions
+ (: (-> (List [Text Definition]) (List [Text Definition]))
+ (|>> (#.Cons [name definition])))
+ self))
+ state)
+ []])
(#.Some already-existing)
((///.throw cannot-define-more-than-once [self-name name]) state))))))
@@ -137,10 +137,10 @@
(extension.lift
(function (_ state)
(let [module (new hash)]
- (#e.Success [(update@ #.modules
- (plist.put name module)
- state)
- []])))))
+ (#error.Success [(update@ #.modules
+ (plist.put name module)
+ state)
+ []])))))
(def: #export (with-module hash name action)
(All [a] (-> Nat Text (Operation a) (Operation [Module a])))
@@ -162,10 +162,10 @@
#.Active #1
_ #0)]
(if active?
- (#e.Success [(update@ #.modules
- (plist.put module-name (set@ #.module-state <tag> module))
- state)
- []])
+ (#error.Success [(update@ #.modules
+ (plist.put module-name (set@ #.module-state <tag> module))
+ state)
+ []])
((///.throw can-only-change-state-of-active-module [module-name <tag>])
state)))
@@ -178,10 +178,10 @@
(function (_ state)
(case (|> state (get@ #.modules) (plist.get module-name))
(#.Some module)
- (#e.Success [state
- (case (get@ #.module-state module)
- <tag> #1
- _ #0)])
+ (#error.Success [state
+ (case (get@ #.module-state module)
+ <tag> #1
+ _ #0)])
#.None
((///.throw unknown-module module-name) state)))))]
@@ -198,7 +198,7 @@
(function (_ state)
(case (|> state (get@ #.modules) (plist.get module-name))
(#.Some module)
- (#e.Success [state (get@ <tag> module)])
+ (#error.Success [state (get@ <tag> module)])
#.None
((///.throw unknown-module module-name) state)))))]
@@ -241,15 +241,15 @@
(case (|> state (get@ #.modules) (plist.get self-name))
(#.Some module)
(let [namespaced-tags (list/map (|>> [self-name]) tags)]
- (#e.Success [(update@ #.modules
- (plist.update self-name
- (|>> (update@ #.tags (function (_ tag-bindings)
- (list/fold (function (_ [idx tag] table)
- (plist.put tag [idx namespaced-tags exported? type] table))
- tag-bindings
- (list.enumerate tags))))
- (update@ #.types (plist.put type-name [namespaced-tags exported? type]))))
- state)
- []]))
+ (#error.Success [(update@ #.modules
+ (plist.update self-name
+ (|>> (update@ #.tags (function (_ tag-bindings)
+ (list/fold (function (_ [idx tag] table)
+ (plist.put tag [idx namespaced-tags exported? type] table))
+ tag-bindings
+ (list.enumerate tags))))
+ (update@ #.types (plist.put type-name [namespaced-tags exported? type]))))
+ state)
+ []]))
#.None
((///.throw unknown-module self-name) state))))))
diff --git a/stdlib/source/lux/language/compiler/analysis/primitive.lux b/stdlib/source/lux/language/compiler/analysis/primitive.lux
index 346906909..bd42825d3 100644
--- a/stdlib/source/lux/language/compiler/analysis/primitive.lux
+++ b/stdlib/source/lux/language/compiler/analysis/primitive.lux
@@ -1,8 +1,8 @@
(.module:
[lux (#- nat int rev)
- [control monad]
- [macro]]
- [// (#+ Analysis Operation)
+ [control
+ monad]]
+ ["." // (#+ Analysis Operation)
[".A" type]
["/." //]])
diff --git a/stdlib/source/lux/language/compiler/analysis/reference.lux b/stdlib/source/lux/language/compiler/analysis/reference.lux
index af134ebe3..5949c0036 100644
--- a/stdlib/source/lux/language/compiler/analysis/reference.lux
+++ b/stdlib/source/lux/language/compiler/analysis/reference.lux
@@ -3,21 +3,20 @@
[control
monad
["ex" exception (#+ exception:)]]
- ["." macro
- [code]]
+ ["." macro]
[language
[type
["tc" check]]]
[data
[text ("text/" Equivalence<Text>)
format]]]
- [// (#+ Analysis Operation)
- [scope]
- [type]
+ ["." // (#+ Analysis Operation)
+ ["." scope]
+ ["." type]
["/." //
- [extension]
+ ["." extension]
[//
- [reference]]]])
+ ["." reference]]]])
(exception: #export (foreign-module-has-not-been-imported {current Text} {foreign Text})
(ex.report ["Current" current]
diff --git a/stdlib/source/lux/language/compiler/analysis/scope.lux b/stdlib/source/lux/language/compiler/analysis/scope.lux
index 3ee0499e8..a10ed6e58 100644
--- a/stdlib/source/lux/language/compiler/analysis/scope.lux
+++ b/stdlib/source/lux/language/compiler/analysis/scope.lux
@@ -5,17 +5,18 @@
[data
[text ("text/" Equivalence<Text>)
format]
- [maybe ("maybe/" Monad<Maybe>)]
- [product]
+ ["." maybe ("maybe/" Monad<Maybe>)]
+ ["." product]
["e" error]
[collection
- [list ("list/" Functor<List> Fold<List> Monoid<List>)]
- [dictionary [plist]]]]]
+ ["." list ("list/" Functor<List> Fold<List> Monoid<List>)]
+ [dictionary
+ ["." plist]]]]]
[// (#+ Operation Compiler)
- ["compiler" //
- [extension]
+ ["/." //
+ ["." extension]
[//
- [reference (#+ Register Variable)]]]])
+ ["." reference (#+ Register Variable)]]]])
(type: Local (Bindings Text [Type Register]))
(type: Foreign (Bindings Text [Type Variable]))
@@ -109,8 +110,8 @@
(|>> (update@ #.counter inc)
(update@ #.mappings (plist.put name [type new-var-id]))))
head)]
- (case (compiler.run' [bundle (set@ #.scopes (#.Cons new-head tail) state)]
- action)
+ (case (///.run' [bundle (set@ #.scopes (#.Cons new-head tail) state)]
+ action)
(#e.Success [[bundle' state'] output])
(case (get@ #.scopes state')
(#.Cons head' tail')
diff --git a/stdlib/source/lux/language/compiler/analysis/structure.lux b/stdlib/source/lux/language/compiler/analysis/structure.lux
index 382eab486..d3ce95cdd 100644
--- a/stdlib/source/lux/language/compiler/analysis/structure.lux
+++ b/stdlib/source/lux/language/compiler/analysis/structure.lux
@@ -1,24 +1,26 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
- [ident]
- [number]
- [product]
- [maybe]
- [text format]
- [collection [list ("list/" Functor<List>)]
+ ["." ident]
+ ["." number]
+ ["." product]
+ ["." maybe]
+ [text
+ format]
+ [collection
+ ["." list ("list/" Functor<List>)]
["dict" dictionary (#+ Dictionary)]]]
["." macro
- [code]]]
- [// (#+ Tag Analysis Operation Compiler)
+ ["." code]]]
+ ["." // (#+ Tag Analysis Operation Compiler)
["//." type]
- [primitive]
- [inference]
+ ["." primitive]
+ ["." inference]
["/." //
- [extension]
+ ["." extension]
["//." //
["." type
["tc" check]]]]])
diff --git a/stdlib/source/lux/language/compiler/analysis/type.lux b/stdlib/source/lux/language/compiler/analysis/type.lux
index f87a96758..8bc0bd53b 100644
--- a/stdlib/source/lux/language/compiler/analysis/type.lux
+++ b/stdlib/source/lux/language/compiler/analysis/type.lux
@@ -3,14 +3,15 @@
[control
[monad (#+ do)]]
[data
- [error]]
- [function]
- [macro]
+ ["." error]]
+ ["." function]
+ ["." macro]
[language
- [type ["tc" check]]]]
+ [type
+ ["tc" check]]]]
[// (#+ Operation)
["/." //
- [extension]]])
+ ["." extension]]])
(def: #export (with-type expected)
(All [a] (-> Type (Operation a) (Operation a)))
diff --git a/stdlib/source/lux/language/compiler/default/cache.lux b/stdlib/source/lux/language/compiler/default/cache.lux
index f41cd0792..f82469cd7 100644
--- a/stdlib/source/lux/language/compiler/default/cache.lux
+++ b/stdlib/source/lux/language/compiler/default/cache.lux
@@ -1,33 +1,35 @@
(.module:
[lux #*
- [data [format [binary (#+ Binary)]]]])
+ [data
+ [format
+ ["_" binary (#+ Binary)]]]])
(def: definition
(Binary Definition)
- ($_ binary.seq binary.type binary.code binary.any))
+ ($_ _.seq _.type _.code _.any))
(def: alias
(Binary [Text Text])
- (binary.seq binary.text binary.text))
+ (_.seq _.text _.text))
## TODO: Remove #module-hash, #imports & #module-state ASAP.
## TODO: Not just from this parser, but from the lux.Module type.
(def: #export module
(Binary Module)
- ($_ binary.seq
+ ($_ _.seq
## #module-hash
- (binary.ignore +0)
+ (_.ignore +0)
## #module-aliases
- (binary.list ..alias)
+ (_.list ..alias)
## #definitions
- (binary.list (binary.seq binary.text ..definition))
+ (_.list (_.seq _.text ..definition))
## #imports
- (binary.list binary.text)
+ (_.list _.text)
## #tags
- (binary.ignore (list))
+ (_.ignore (list))
## #types
- (binary.ignore (list))
+ (_.ignore (list))
## #module-annotations
- (binary.maybe binary.code)
+ (_.maybe _.code)
## #module-state
- (binary.ignore #.Cached)))
+ (_.ignore #.Cached)))
diff --git a/stdlib/source/lux/language/compiler/default/repl/type.lux b/stdlib/source/lux/language/compiler/default/repl/type.lux
index c9b68c06e..4b2b8dc02 100644
--- a/stdlib/source/lux/language/compiler/default/repl/type.lux
+++ b/stdlib/source/lux/language/compiler/default/repl/type.lux
@@ -6,22 +6,24 @@
["p" parser]
pipe]
[data
- [error (#+ Error)]
+ ["." error (#+ Error)]
[text
format]
[format
[xml (#+ XML)]
[json (#+ JSON)]]
- [collection [list]]]
+ [collection
+ ["." list]]]
[time
[instant (#+ Instant)]
[duration (#+ Duration)]
[date (#+ Date)]]
- [function]
+ ["." function]
["." macro
- [code]
- [poly (#+ Poly)]]
- [language [type]]])
+ ["." code]
+ ["." poly (#+ Poly)]]
+ [language
+ ["." type]]])
(exception: #export (cannot-represent-value {type Type})
(ex.report ["Type" (%type type)]))
diff --git a/stdlib/source/lux/language/compiler/extension.lux b/stdlib/source/lux/language/compiler/extension.lux
index fc41aa30d..10d2d62ca 100644
--- a/stdlib/source/lux/language/compiler/extension.lux
+++ b/stdlib/source/lux/language/compiler/extension.lux
@@ -4,11 +4,12 @@
[monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
- [error (#+ Error)]
- [text]
- [collection ["dict" dictionary (#+ Dictionary)]]]
- [function]]
- [//])
+ ["." error (#+ Error)]
+ ["." text]
+ [collection
+ ["dict" dictionary (#+ Dictionary)]]]
+ ["." function]]
+ ["." //])
(type: #export (Extension i)
[Text (List i)])
diff --git a/stdlib/source/lux/language/compiler/extension/analysis.lux b/stdlib/source/lux/language/compiler/extension/analysis.lux
index 0f57de1ff..4d78ceb43 100644
--- a/stdlib/source/lux/language/compiler/extension/analysis.lux
+++ b/stdlib/source/lux/language/compiler/extension/analysis.lux
@@ -2,12 +2,12 @@
[lux #*
[data
[collection
- [dictionary]]]]
+ ["." dictionary]]]]
[///
[analysis (#+ Bundle)]]
[/
- [common]
- [host]])
+ ["." common]
+ ["." host]])
(def: #export bundle
Bundle
diff --git a/stdlib/source/lux/language/compiler/extension/analysis/common.lux b/stdlib/source/lux/language/compiler/extension/analysis/common.lux
index 9616f2533..0dc405438 100644
--- a/stdlib/source/lux/language/compiler/extension/analysis/common.lux
+++ b/stdlib/source/lux/language/compiler/extension/analysis/common.lux
@@ -1,31 +1,32 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]
[thread (#+ Box)]]
- [concurrency [atom (#+ Atom)]]
+ [concurrency
+ [atom (#+ Atom)]]
[data
["." text
format]
[collection
- [list ("list/" Functor<List>)]
- [array]
+ ["." list ("list/" Functor<List>)]
+ ["." array]
["dict" dictionary (#+ Dictionary)]]]
["." language
[type ["tc" check]]]
[io (#+ IO)]]
["." ////
- [analysis (#+ Analysis Bundle)
+ ["." analysis (#+ Analysis Handler Bundle)
[".A" type]
[".A" case]
[".A" function]]]
["." ///
- [bundle]])
+ ["." bundle]])
## [Utils]
(def: (simple inputsT+ outputT)
- (-> (List Type) Type analysis.Handler)
+ (-> (List Type) Type Handler)
(let [num-expected (list.size inputsT+)]
(function (_ extension-name analyse args)
(let [num-actual (list.size args)]
@@ -41,25 +42,25 @@
(////.throw bundle.incorrect-arity [extension-name num-expected num-actual]))))))
(def: #export (nullary valueT)
- (-> Type analysis.Handler)
+ (-> Type Handler)
(simple (list) valueT))
(def: #export (unary inputT outputT)
- (-> Type Type analysis.Handler)
+ (-> Type Type Handler)
(simple (list inputT) outputT))
(def: #export (binary subjectT paramT outputT)
- (-> Type Type Type analysis.Handler)
+ (-> Type Type Type Handler)
(simple (list subjectT paramT) outputT))
(def: #export (trinary subjectT param0T param1T outputT)
- (-> Type Type Type Type analysis.Handler)
+ (-> Type Type Type Type Handler)
(simple (list subjectT param0T param1T) outputT))
## [Analysers]
## "lux is" represents reference/pointer equality.
(def: lux::is
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -69,7 +70,7 @@
## "lux try" provides a simple way to interact with the host platform's
## error-handling facilities.
(def: lux::try
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(case args
(^ (list opC))
@@ -84,7 +85,7 @@
(////.throw bundle.incorrect-arity [extension-name +1 (list.size args)]))))
(def: lux::in-module
- analysis.Handler
+ Handler
(function (_ extension-name analyse argsC+)
(case argsC+
(^ (list [_ (#.Text module-name)] exprC))
@@ -96,7 +97,7 @@
## (do-template [<name> <type>]
## [(def: <name>
-## analysis.Handler
+## Handler
## (function (_ extension-name analyse args)
## (case args
## (^ (list typeC valueC))
@@ -114,7 +115,7 @@
## )
(def: lux::check::type
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(case args
(^ (list valueC))
@@ -205,7 +206,7 @@
)))
(def: array::get
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -213,7 +214,7 @@
analyse args))))
(def: array::put
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -221,7 +222,7 @@
analyse args))))
(def: array::remove
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -262,7 +263,7 @@
)))
(def: atom::new
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(case args
(^ (list initC))
@@ -277,7 +278,7 @@
(////.throw bundle.incorrect-arity [extension-name +1 (list.size args)]))))
(def: atom::read
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -285,7 +286,7 @@
analyse args))))
(def: atom::compare-and-swap
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[var-id varT] (typeA.with-env tc.var)]
@@ -302,7 +303,7 @@
)))
(def: box::new
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(case args
(^ (list initC))
@@ -317,7 +318,7 @@
(////.throw bundle.incorrect-arity [extension-name +1 (list.size args)]))))
(def: box::read
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[thread-id threadT] (typeA.with-env tc.var)
@@ -326,7 +327,7 @@
analyse args))))
(def: box::write
- analysis.Handler
+ Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
[[thread-id threadT] (typeA.with-env tc.var)
diff --git a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
index da4d4461b..ef5e9317f 100644
--- a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
+++ b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
@@ -1,32 +1,32 @@
(.module:
[lux (#- char int)
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["p" parser]
["ex" exception (#+ exception:)]
pipe]
[data
["e" error]
- [maybe]
- [product]
- [text ("text/" Equivalence<Text>)
+ ["." maybe]
+ ["." product]
+ ["." text ("text/" Equivalence<Text>)
format]
[collection
- [list ("list/" Fold<List> Functor<List> Monoid<List>)]
- [array]
- [dictionary (#+ Dictionary)]]]
+ ["." list ("list/" Fold<List> Functor<List> Monoid<List>)]
+ ["." array]
+ ["." dictionary (#+ Dictionary)]]]
["." macro
["s" syntax]]
[language
["." type
- [check]]]
- [host]]
+ ["." check]]]
+ ["." host]]
[//
- [common]
+ ["." common]
["/." //
- [bundle]
+ ["." bundle]
["//." // ("operation/" Monad<Operation>)
- [analysis (#+ Analysis Operation Handler Bundle)
+ ["." analysis (#+ Analysis Operation Handler Bundle)
[".A" type]
[".A" inference]]]]]
)
diff --git a/stdlib/source/lux/language/compiler/extension/bundle.lux b/stdlib/source/lux/language/compiler/extension/bundle.lux
index 222ad7f5e..dce95cfb1 100644
--- a/stdlib/source/lux/language/compiler/extension/bundle.lux
+++ b/stdlib/source/lux/language/compiler/extension/bundle.lux
@@ -9,7 +9,7 @@
[collection
[list ("list/" Functor<List>)]
["dict" dictionary (#+ Dictionary)]]]]
- [//])
+ [// (#+ Handler Bundle)])
(exception: #export (incorrect-arity {name Text} {arity Nat} {args Nat})
(ex.report ["Extension" (%t name)]
@@ -21,18 +21,18 @@
## [Utils]
(def: #export empty
- //.Bundle
+ Bundle
(dict.new text.Hash<Text>))
(def: #export (install name anonymous)
(All [s i o]
- (-> Text (//.Handler s i o)
- (-> (//.Bundle s i o) (//.Bundle s i o))))
+ (-> Text (Handler s i o)
+ (-> (Bundle s i o) (Bundle s i o))))
(dict.put name anonymous))
(def: #export (prefix prefix)
(All [s i o]
- (-> Text (-> (//.Bundle s i o) (//.Bundle s i o))))
+ (-> Text (-> (Bundle s i o) (Bundle s i o))))
(|>> dict.entries
(list/map (function (_ [key val]) [(format prefix " " key) val]))
(dict.from-list text.Hash<Text>)))
diff --git a/stdlib/source/lux/language/compiler/init.lux b/stdlib/source/lux/language/compiler/init.lux
index 92a066b7e..648211ca7 100644
--- a/stdlib/source/lux/language/compiler/init.lux
+++ b/stdlib/source/lux/language/compiler/init.lux
@@ -1,7 +1,7 @@
(.module:
lux
- [///]
- [///host])
+ ["." ///
+ ["." host]])
(def: #export (cursor file)
(-> Text Cursor)
@@ -23,15 +23,15 @@
(`` (def: #export info
Info
- {#.target (for {(~~ (static ///host.common-lisp)) ///host.common-lisp
- (~~ (static ///host.js)) ///host.js
- (~~ (static ///host.jvm)) ///host.jvm
- (~~ (static ///host.lua)) ///host.lua
- (~~ (static ///host.php)) ///host.php
- (~~ (static ///host.python)) ///host.python
- (~~ (static ///host.r)) ///host.r
- (~~ (static ///host.ruby)) ///host.ruby
- (~~ (static ///host.scheme)) ///host.scheme})
+ {#.target (for {(~~ (static host.common-lisp)) host.common-lisp
+ (~~ (static host.js)) host.js
+ (~~ (static host.jvm)) host.jvm
+ (~~ (static host.lua)) host.lua
+ (~~ (static host.php)) host.php
+ (~~ (static host.python)) host.python
+ (~~ (static host.r)) host.r
+ (~~ (static host.ruby)) host.ruby
+ (~~ (static host.scheme)) host.scheme})
#.version ///.version
#.mode #.Build}))
diff --git a/stdlib/source/lux/language/compiler/meta/archive.lux b/stdlib/source/lux/language/compiler/meta/archive.lux
index 4a981007a..570221385 100644
--- a/stdlib/source/lux/language/compiler/meta/archive.lux
+++ b/stdlib/source/lux/language/compiler/meta/archive.lux
@@ -2,18 +2,22 @@
[lux #*
[control
["ex" exception (#+ exception:)]
- [equivalence (#+ Equivalence)]
- [monad (#+ do)]]
+ ["." equivalence (#+ Equivalence)]
+ ["." monad (#+ do)]]
[data
- [error (#+ Error)]
- [ident]
+ ["." error (#+ Error)]
+ ["." ident]
["." text
format]
- [collection ["dict" dictionary (#+ Dictionary)]]]
- [language [type (#+ :share)]]
- [type abstract]
- [world [file (#+ File)]]]
- [//// (#+ Version)])
+ [collection
+ ["dict" dictionary (#+ Dictionary)]]]
+ [language
+ [type (#+ :share)]]
+ [type
+ abstract]
+ [world
+ [file (#+ File)]]]
+ ["." //// (#+ Version)])
## Key
(type: #export Signature
diff --git a/stdlib/source/lux/language/compiler/meta/cache.lux b/stdlib/source/lux/language/compiler/meta/cache.lux
index d382c5860..59d2f3c3b 100644
--- a/stdlib/source/lux/language/compiler/meta/cache.lux
+++ b/stdlib/source/lux/language/compiler/meta/cache.lux
@@ -1,27 +1,29 @@
(.module:
[lux (#- Module)
[control
- [monad (#+ Monad do)]
+ ["." monad (#+ Monad do)]
["ex" exception (#+ exception:)]
pipe]
[data
- [bit ("bit/" Equivalence<Bit>)]
- [maybe]
- [error]
- [product]
- [format [binary (#+ Binary)]]
+ ["." bit ("bit/" Equivalence<Bit>)]
+ ["." maybe]
+ ["." error]
+ ["." product]
+ [format
+ ["." binary (#+ Binary)]]
["." text
format]
[collection
- [list ("list/" Functor<List> Fold<List>)]
+ ["." list ("list/" Functor<List> Fold<List>)]
["dict" dictionary (#+ Dictionary)]
- [set (#+ Set)]]]
- [world [file (#+ File System)]]]
+ ["." set (#+ Set)]]]
+ [world
+ [file (#+ File System)]]]
[//io (#+ Context Module)]
- [//io/context]
- [//io/archive]
- [//archive (#+ Signature Key Descriptor Document Archive)]
- [/dependency (#+ Dependency Graph)])
+ ["." //io/context]
+ ["." //io/archive]
+ ["." //archive (#+ Signature Key Descriptor Document Archive)]
+ ["." /dependency (#+ Dependency Graph)])
(exception: #export (cannot-delete-cached-file {file File})
(ex.report ["File" file]))
diff --git a/stdlib/source/lux/language/compiler/meta/cache/dependency.lux b/stdlib/source/lux/language/compiler/meta/cache/dependency.lux
index b12a7e9fb..6f7994c92 100644
--- a/stdlib/source/lux/language/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/lux/language/compiler/meta/cache/dependency.lux
@@ -1,7 +1,7 @@
(.module:
[lux (#- Module)
[data
- [text]
+ ["." text]
[collection
[list ("list/" Functor<List> Fold<List>)]
["dict" dictionary (#+ Dictionary)]]]]
diff --git a/stdlib/source/lux/language/compiler/meta/io/archive.lux b/stdlib/source/lux/language/compiler/meta/io/archive.lux
index e69f6eaf4..4a6e3fb39 100644
--- a/stdlib/source/lux/language/compiler/meta/io/archive.lux
+++ b/stdlib/source/lux/language/compiler/meta/io/archive.lux
@@ -4,14 +4,14 @@
monad
["ex" exception (#+ exception:)]]
[data
- [error]
+ ["." error]
["." text
format]]
[world
- [file (#+ File System)]
+ ["." file (#+ File System)]
[blob (#+ Blob)]]]
- [/////host]
- [// (#+ Module)])
+ ["." /////host]
+ ["." // (#+ Module)])
(type: #export Document File)
diff --git a/stdlib/source/lux/language/compiler/meta/io/context.lux b/stdlib/source/lux/language/compiler/meta/io/context.lux
index 4658858ff..eab4b284a 100644
--- a/stdlib/source/lux/language/compiler/meta/io/context.lux
+++ b/stdlib/source/lux/language/compiler/meta/io/context.lux
@@ -4,15 +4,16 @@
monad
["ex" exception (#+ Exception exception:)]]
[data
- [error]
+ ["." error]
[text
format
- [encoding]]]
+ ["." encoding]]]
[world
- [file (#+ File System)]
+ ["." file (#+ File System)]
[blob (#+ Blob)]]]
- [/////host]
- [// (#+ Context Module)])
+ ["." // (#+ Context Module)
+ [////
+ ["." host]]])
(type: #export Extension Text)
@@ -24,15 +25,15 @@
(def: host-extension
Extension
- (`` (for {(~~ (static /////host.common-lisp)) ".cl"
- (~~ (static /////host.js)) ".js"
- (~~ (static /////host.jvm)) ".jvm"
- (~~ (static /////host.lua)) ".lua"
- (~~ (static /////host.php)) ".php"
- (~~ (static /////host.python)) ".py"
- (~~ (static /////host.r)) ".r"
- (~~ (static /////host.ruby)) ".rb"
- (~~ (static /////host.scheme)) ".scm"})))
+ (`` (for {(~~ (static host.common-lisp)) ".cl"
+ (~~ (static host.js)) ".js"
+ (~~ (static host.jvm)) ".jvm"
+ (~~ (static host.lua)) ".lua"
+ (~~ (static host.php)) ".php"
+ (~~ (static host.python)) ".py"
+ (~~ (static host.r)) ".r"
+ (~~ (static host.ruby)) ".rb"
+ (~~ (static host.scheme)) ".scm"})))
(def: lux-extension Extension ".lux")
diff --git a/stdlib/source/lux/language/compiler/synthesis.lux b/stdlib/source/lux/language/compiler/synthesis.lux
index f4d7a6407..8dd99986b 100644
--- a/stdlib/source/lux/language/compiler/synthesis.lux
+++ b/stdlib/source/lux/language/compiler/synthesis.lux
@@ -3,12 +3,13 @@
[control [monad (#+ do)]]
[data
[error (#+ Error)]
- [collection ["dict" dictionary (#+ Dictionary)]]]]
+ [collection
+ ["dict" dictionary (#+ Dictionary)]]]]
["." //
- [analysis (#+ Environment Arity Analysis)]
- [extension (#+ Extension)]
+ ["." analysis (#+ Environment Arity Analysis)]
+ ["." extension (#+ Extension)]
[//
- [reference (#+ Register Variable Reference)]]])
+ ["." reference (#+ Register Variable Reference)]]])
(type: #export Resolver (Dictionary Variable Variable))
diff --git a/stdlib/source/lux/language/compiler/synthesis/case.lux b/stdlib/source/lux/language/compiler/synthesis/case.lux
index 92a17fa71..8301e11aa 100644
--- a/stdlib/source/lux/language/compiler/synthesis/case.lux
+++ b/stdlib/source/lux/language/compiler/synthesis/case.lux
@@ -3,20 +3,21 @@
[control
[equivalence (#+ Equivalence)]
pipe
- [monad (#+ do)]]
+ ["." monad (#+ do)]]
[data
- [product]
+ ["." product]
[bit ("bit/" Equivalence<Bit>)]
[text ("text/" Equivalence<Text>)
format]
[number ("frac/" Equivalence<Frac>)]
- [collection [list ("list/" Fold<List> Monoid<List>)]]]]
- [// (#+ Path Synthesis Operation Compiler)
- [function]
+ [collection
+ ["." list ("list/" Fold<List> Monoid<List>)]]]]
+ ["." // (#+ Path Synthesis Operation Compiler)
+ ["." function]
["/." // ("operation/" Monad<Operation>)
- [analysis (#+ Pattern Match Analysis)]
+ ["." analysis (#+ Pattern Match Analysis)]
[//
- [reference]]]])
+ ["." reference]]]])
(def: (path' pattern bodyC)
(-> Pattern (Operation Path) (Operation Path))
diff --git a/stdlib/source/lux/language/compiler/synthesis/expression.lux b/stdlib/source/lux/language/compiler/synthesis/expression.lux
index 999d49b15..e122afc32 100644
--- a/stdlib/source/lux/language/compiler/synthesis/expression.lux
+++ b/stdlib/source/lux/language/compiler/synthesis/expression.lux
@@ -1,20 +1,20 @@
(.module:
[lux (#- primitive)
[control
- [monad (#+ do)]]
+ ["." monad (#+ do)]]
[data
- [maybe]
+ ["." maybe]
[collection
- [list ("list/" Functor<List>)]
+ ["." list ("list/" Functor<List>)]
["dict" dictionary (#+ Dictionary)]]]]
- [// (#+ Synthesis Compiler)
- [function]
- [case]
+ ["." // (#+ Synthesis Compiler)
+ ["." function]
+ ["." case]
["/." // ("operation/" Monad<Operation>)
- [analysis (#+ Analysis)]
- [extension]
+ ["." analysis (#+ Analysis)]
+ ["." extension]
[//
- [reference]]]])
+ ["." reference]]]])
(def: (primitive analysis)
(-> analysis.Primitive //.Primitive)
diff --git a/stdlib/source/lux/language/compiler/synthesis/function.lux b/stdlib/source/lux/language/compiler/synthesis/function.lux
index 0fadbc6d1..05f1c2e96 100644
--- a/stdlib/source/lux/language/compiler/synthesis/function.lux
+++ b/stdlib/source/lux/language/compiler/synthesis/function.lux
@@ -1,22 +1,22 @@
(.module:
[lux (#- function)
[control
- [monad (#+ do)]
- [state]
+ ["." monad (#+ do)]
+ ["." state]
pipe
["ex" exception (#+ exception:)]]
[data
- [maybe ("maybe/" Monad<Maybe>)]
- [error]
+ ["." maybe ("maybe/" Monad<Maybe>)]
+ ["." error]
[collection
- [list ("list/" Functor<List> Monoid<List> Fold<List>)]
+ ["." list ("list/" Functor<List> Monoid<List> Fold<List>)]
["dict" dictionary (#+ Dictionary)]]]]
- [// (#+ Synthesis Operation Compiler)
- [loop]
+ ["." // (#+ Synthesis Operation Compiler)
+ ["." loop (#+ Transform)]
[///
- [reference (#+ Variable)]
+ ["." reference (#+ Variable)]
["." compiler
- [analysis (#+ Environment Arity Analysis)]]]])
+ ["." analysis (#+ Environment Arity Analysis)]]]])
(def: #export nested?
(-> Arity Bit)
@@ -65,7 +65,7 @@
(wrap (//.function/apply [funcS argsS])))))))
(def: (prepare up down)
- (-> Arity Arity (loop.Transform Synthesis))
+ (-> Arity Arity (Transform Synthesis))
(.function (_ body)
(if (nested? up)
(#.Some body)
diff --git a/stdlib/source/lux/language/compiler/synthesis/loop.lux b/stdlib/source/lux/language/compiler/synthesis/loop.lux
index ea6589f21..033d5e70e 100644
--- a/stdlib/source/lux/language/compiler/synthesis/loop.lux
+++ b/stdlib/source/lux/language/compiler/synthesis/loop.lux
@@ -1,20 +1,21 @@
(.module:
[lux (#- loop)
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["p" parser]]
[data
- [maybe ("maybe/" Monad<Maybe>)]
- [collection [list ("list/" Functor<List>)]]]
+ ["." maybe ("maybe/" Monad<Maybe>)]
+ [collection
+ ["." list ("list/" Functor<List>)]]]
[macro
- [code]
- [syntax]]]
- [// (#+ Path Abstraction Synthesis)
+ ["." code]
+ ["." syntax]]]
+ ["." // (#+ Path Abstraction Synthesis)
[///
- [reference (#+ Register Variable)]
+ ["." reference (#+ Register Variable)]
[compiler
- [analysis (#+ Environment)]
- [extension]]]])
+ ["." analysis (#+ Environment)]
+ ["." extension]]]])
(type: #export (Transform a)
(-> a (Maybe a)))
diff --git a/stdlib/source/lux/language/compiler/translation.lux b/stdlib/source/lux/language/compiler/translation.lux
index b822d3cf8..462c61ec5 100644
--- a/stdlib/source/lux/language/compiler/translation.lux
+++ b/stdlib/source/lux/language/compiler/translation.lux
@@ -4,18 +4,18 @@
["ex" exception (#+ exception:)]
[monad (#+ do)]]
[data
- [product]
- [error (#+ Error)]
+ ["." product]
+ ["." error (#+ Error)]
[ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)]
["." text
format]
[collection
- [row (#+ Row)]
+ ["." row (#+ Row)]
["dict" dictionary (#+ Dictionary)]]]
- [function]
- [world [file (#+ File)]]]
+ [world
+ [file (#+ File)]]]
["." //
- [extension]]
+ ["." extension]]
[//synthesis (#+ Synthesis)])
(do-template [<name>]
@@ -65,6 +65,12 @@
(type: #export (Compiler anchor expression statement)
(extension.Compiler (State anchor expression statement) Synthesis expression))
+(type: #export (Handler anchor expression statement)
+ (extension.Handler (State anchor expression statement) Synthesis expression))
+
+(type: #export (Bundle anchor expression statement)
+ (extension.Bundle (State anchor expression statement) Synthesis expression))
+
(def: #export (init host)
(All [anchor expression statement]
(-> (Host expression statement)
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux
index f7b1adb7a..d2e9d8d98 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/case.jvm.lux
@@ -4,38 +4,40 @@
[monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
- [number]
+ ["." number]
["." text
format]
[collection
[list ("list/" Functor<List> Fold<List>)]
[set (#+ Set)]]]]
- [/////
- [reference (#+ Register)]
- [host ["_" scheme (#+ Expression Computation Var)]]
- [compiler ("operation/" Monad<Operation>)
- [synthesis (#+ Synthesis Path)]]]
- [//runtime (#+ Operation Compiler)]
- [//reference])
+ [//
+ ["." runtime (#+ Operation Compiler)]
+ ["." reference]
+ ["/." /// ("operation/" Monad<Operation>)
+ ["." synthesis (#+ Synthesis Path)]
+ [//
+ [reference (#+ Register)]
+ [host
+ ["_" scheme (#+ Expression Computation Var)]]]]])
(def: #export (let translate [valueS register bodyS])
(-> Compiler [Synthesis Register Synthesis]
(Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[valueO (translate valueS)
bodyO (translate bodyS)]
- (wrap (_.let (list [(//reference.local' register) valueO])
+ (wrap (_.let (list [(reference.local' register) valueO])
bodyO))))
(def: #export (record-get translate valueS pathP)
(-> Compiler Synthesis (List [Nat Bit])
(Operation Expression))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[valueO (translate valueS)]
(wrap (list/fold (function (_ [idx tail?] source)
(.let [method (.if tail?
- //runtime.product//right
- //runtime.product//left)]
+ runtime.product//right
+ runtime.product//left)]
(method source (_.int (:coerce Int idx)))))
valueO
pathP))))
@@ -43,7 +45,7 @@
(def: #export (if translate [testS thenS elseS])
(-> Compiler [Synthesis Synthesis Synthesis]
(Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[testO (translate testS)
thenO (translate thenS)
elseO (translate elseS)]
@@ -97,9 +99,9 @@
(def: (pm-catch handler)
(-> Expression Computation)
(_.lambda [(list $alt_error) #.None]
- (_.if (|> $alt_error (_.eqv?/2 pm-error))
- handler
- (_.raise/1 $alt_error))))
+ (_.if (|> $alt_error (_.eqv?/2 pm-error))
+ handler
+ (_.raise/1 $alt_error))))
(def: (pattern-matching' translate pathP)
(-> Compiler Path (Operation Expression))
@@ -111,7 +113,7 @@
(operation/wrap pop-cursor!)
(#synthesis.Bind register)
- (operation/wrap (_.define (//reference.local' register) [(list) #.None]
+ (operation/wrap (_.define (reference.local' register) [(list) #.None]
cursor-top))
(^template [<tag> <format> <=>]
@@ -125,7 +127,7 @@
(^template [<pm> <flag> <prep>]
(^ (<pm> idx))
- (operation/wrap (_.let (list [@temp (|> idx <prep> .int _.int (//runtime.sum//get cursor-top <flag>))])
+ (operation/wrap (_.let (list [@temp (|> idx <prep> .int _.int (runtime.sum//get cursor-top <flag>))])
(_.if (_.null?/1 @temp)
fail-pm!
(push-cursor! @temp)))))
@@ -135,12 +137,12 @@
(^template [<pm> <getter> <prep>]
(^ (<pm> idx))
(operation/wrap (|> idx <prep> .int _.int (<getter> cursor-top) push-cursor!)))
- ([synthesis.member/left //runtime.product//left (<|)]
- [synthesis.member/right //runtime.product//right inc])
+ ([synthesis.member/left runtime.product//left (<|)]
+ [synthesis.member/right runtime.product//right inc])
(^template [<tag> <computation>]
(^ (<tag> [leftP rightP]))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[leftO (pattern-matching' translate leftP)
rightO (pattern-matching' translate rightP)]
(wrap <computation>)))
@@ -154,11 +156,11 @@
leftO))))])
_
- (compiler.throw unrecognized-path [])))
+ (////.throw unrecognized-path [])))
(def: (pattern-matching translate pathP)
(-> Compiler Path (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[pattern-matching! (pattern-matching' translate pathP)]
(wrap (_.with-exception-handler
(pm-catch (_.raise/1 (_.string "Invalid expression for pattern-matching.")))
@@ -167,7 +169,7 @@
(def: #export (case translate [valueS pathP])
(-> Compiler [Synthesis Path] (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[valueO (translate valueS)]
(<| (:: @ map (_.let (list [@cursor (_.list/* (list valueO))]
[@savepoint (_.list/* (list))])))
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux
index 3cbefbf69..7ff3770ae 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/expression.jvm.lux
@@ -1,17 +1,18 @@
(.module:
[lux #*
- [control [monad (#+ do)]]]
+ [control
+ [monad (#+ do)]]]
[//
[runtime (#+ Compiler)]
- [primitive]
- [structure]
- [reference]
- [function]
- [case]
- [loop]
+ ["." primitive]
+ ["." structure]
+ ["." reference]
+ ["." function]
+ ["." case]
+ ["." loop]
["." ///
- [synthesis]
- [extension]]])
+ ["." synthesis]
+ ["." extension]]])
(def: #export (translate synthesis)
Compiler
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux
index c7d161f14..a40b4953f 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/extension.jvm.lux
@@ -1,36 +1,15 @@
(.module:
[lux #*
- [control
- [monad (#+ do)]
- ["ex" exception (#+ exception:)]]
[data
- [maybe]
- [text
- format]
- [collection ["dict" dictionary (#+ Dictionary)]]]]
- [/////
- [reference (#+ Register Variable)]
- [host ["_" scheme (#+ Computation)]]
- [compiler ("operation/" Monad<Operation>)
- [synthesis (#+ Synthesis)]]]
- [//runtime (#+ Operation Compiler)]
- [/common]
- ## [/host]
- )
+ [collection
+ ["." dictionary]]]]
+ [//
+ [runtime (#+ Bundle)]]
+ [/
+ ["." common]
+ ["." host]])
-(exception: #export (unknown-extension {message Text})
- message)
-
-(def: extensions
- /common.Bundle
- (|> /common.extensions
- ## (dict.merge /host.extensions)
- ))
-
-(def: #export (extension translate name args)
- (-> Compiler Text (List Synthesis)
- (Operation Computation))
- (<| (maybe.default (compiler.throw unknown-extension (%t name)))
- (do maybe.Monad<Maybe>
- [ext (dict.get name extensions)]
- (wrap (ext translate args)))))
+(def: #export bundle
+ Bundle
+ (|> common.bundle
+ (dictionary.merge host.bundle)))
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux
index 40f817aea..289634a4b 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/extension/common.jvm.lux
@@ -1,34 +1,32 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
["ex" exception (#+ exception:)]]
[data
["e" error]
- [product]
+ ["." product]
["." text
format]
[number (#+ hex)]
[collection
- [list ("list/" Functor<List>)]
+ ["." list ("list/" Functor<List>)]
["dict" dictionary (#+ Dictionary)]]]
- [macro (#+ with-gensyms)
- [code]
+ ["." macro (#+ with-gensyms)
+ ["." code]
["s" syntax (#+ syntax:)]]
- [host]]
- [//////
- [host ["_" scheme (#+ Expression Computation)]]
- ["." compiler
- [synthesis (#+ Synthesis)]]]
- [///runtime (#+ Operation Compiler)])
+ [host (#+ import:)]]
+ [///
+ ["." runtime (#+ Operation Compiler Handler Bundle)]
+ ["//." ///
+ ["." synthesis (#+ Synthesis)]
+ [extension
+ ["." bundle]]
+ [//
+ [host
+ ["_" scheme (#+ Expression Computation)]]]]])
## [Types]
-(type: #export Extension
- (-> Compiler (List Synthesis) (Operation Computation)))
-
-(type: #export Bundle
- (Dictionary Text Extension))
-
(syntax: (Vector {size s.nat} elemT)
(wrap (list (` [(~+ (list.repeat size elemT))]))))
@@ -39,43 +37,25 @@
(type: #export Variadic (-> (List Expression) Computation))
## [Utils]
-(def: #export (install name unnamed)
- (-> Text (-> Text Extension)
- (-> Bundle Bundle))
- (dict.put name (unnamed name)))
-
-(def: #export (prefix prefix bundle)
- (-> Text Bundle Bundle)
- (|> bundle
- dict.entries
- (list/map (function (_ [key val]) [(format prefix " " key) val]))
- (dict.from-list text.Hash<Text>)))
-
-(exception: #export (wrong-arity {extension Text} {expected Nat} {actual Nat})
- (ex.report ["Extension" (%t extension)]
- ["Expected" (|> expected .int %i)]
- ["Actual" (|> actual .int %i)]))
-
(syntax: (arity: {name s.local-symbol} {arity s.nat})
(with-gensyms [g!_ g!extension g!name g!translate g!inputs]
(do @
[g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))]
(wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!extension))
(-> (-> (..Vector (~ (code.nat arity)) Expression) Computation)
- (-> Text ..Extension))
- (function ((~ g!_) (~ g!name))
- (function ((~ g!_) (~ g!translate) (~ g!inputs))
- (case (~ g!inputs)
- (^ (list (~+ g!input+)))
- (do compiler.Monad<Operation>
- [(~+ (|> g!input+
- (list/map (function (_ g!input)
- (list g!input (` ((~ g!translate) (~ g!input))))))
- list.concat))]
- ((~' wrap) ((~ g!extension) [(~+ g!input+)])))
-
- (~' _)
- (compiler.throw wrong-arity [(~ g!name) +1 (list.size (~ g!inputs))])))))))))))
+ Handler)
+ (function ((~ g!_) (~ g!name) (~ g!translate) (~ g!inputs))
+ (case (~ g!inputs)
+ (^ (list (~+ g!input+)))
+ (do /////.Monad<Operation>
+ [(~+ (|> g!input+
+ (list/map (function (_ g!input)
+ (list g!input (` ((~ g!translate) (~ g!input))))))
+ list.concat))]
+ ((~' wrap) ((~ g!extension) [(~+ g!input+)])))
+
+ (~' _)
+ (/////.throw bundle.incorrect-arity [(~ g!name) +1 (list.size (~ g!inputs))]))))))))))
(arity: nullary +0)
(arity: unary +1)
@@ -83,20 +63,20 @@
(arity: trinary +3)
(def: #export (variadic extension)
- (-> Variadic (-> Text Extension))
+ (-> Variadic Handler)
(function (_ extension-name)
(function (_ translate inputsS)
- (do compiler.Monad<Operation>
+ (do /////.Monad<Operation>
[inputsI (monad.map @ translate inputsS)]
(wrap (extension inputsI))))))
-## [Extensions]
+## [Bundle]
## [[Lux]]
-(def: extensions/lux
+(def: bundle::lux
Bundle
- (|> (dict.new text.Hash<Text>)
- (install "is?" (binary (product.uncurry _.eq?/2)))
- (install "try" (unary ///runtime.lux//try))))
+ (|> bundle.empty
+ (bundle.install "is?" (binary (product.uncurry _.eq?/2)))
+ (bundle.install "try" (unary runtime.lux//try))))
## [[Bits]]
(do-template [<name> <op>]
@@ -104,67 +84,67 @@
Binary
(<op> paramO subjectO))]
- [bit//and _.bit-and/2]
- [bit//or _.bit-or/2]
- [bit//xor _.bit-xor/2]
+ [bit::and _.bit-and/2]
+ [bit::or _.bit-or/2]
+ [bit::xor _.bit-xor/2]
)
-(def: (bit//left-shift [subjectO paramO])
+(def: (bit::left-shift [subjectO paramO])
Binary
(_.arithmetic-shift/2 (_.remainder/2 (_.int 64) paramO)
subjectO))
-(def: (bit//arithmetic-right-shift [subjectO paramO])
+(def: (bit::arithmetic-right-shift [subjectO paramO])
Binary
(_.arithmetic-shift/2 (|> paramO (_.remainder/2 (_.int 64)) (_.*/2 (_.int -1)))
subjectO))
-(def: (bit//logical-right-shift [subjectO paramO])
+(def: (bit::logical-right-shift [subjectO paramO])
Binary
- (///runtime.bit//logical-right-shift (_.remainder/2 (_.int 64) paramO) subjectO))
+ (runtime.bit//logical-right-shift (_.remainder/2 (_.int 64) paramO) subjectO))
-(def: extensions/bit
+(def: bundle::bit
Bundle
- (<| (prefix "bit")
- (|> (dict.new text.Hash<Text>)
- (install "and" (binary bit//and))
- (install "or" (binary bit//or))
- (install "xor" (binary bit//xor))
- (install "left-shift" (binary bit//left-shift))
- (install "logical-right-shift" (binary bit//logical-right-shift))
- (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
+ (<| (bundle.prefix "bit")
+ (|> bundle.empty
+ (bundle.install "and" (binary bit::and))
+ (bundle.install "or" (binary bit::or))
+ (bundle.install "xor" (binary bit::xor))
+ (bundle.install "left-shift" (binary bit::left-shift))
+ (bundle.install "logical-right-shift" (binary bit::logical-right-shift))
+ (bundle.install "arithmetic-right-shift" (binary bit::arithmetic-right-shift))
)))
## [[Arrays]]
-(def: (array//new size0)
+(def: (array::new size0)
Unary
(_.make-vector/2 size0 _.nil))
-(def: (array//get [arrayO idxO])
+(def: (array::get [arrayO idxO])
Binary
- (///runtime.array//get arrayO idxO))
+ (runtime.array//get arrayO idxO))
-(def: (array//put [arrayO idxO elemO])
+(def: (array::put [arrayO idxO elemO])
Trinary
- (///runtime.array//put arrayO idxO elemO))
+ (runtime.array//put arrayO idxO elemO))
-(def: (array//remove [arrayO idxO])
+(def: (array::remove [arrayO idxO])
Binary
- (///runtime.array//put arrayO idxO _.nil))
+ (runtime.array//put arrayO idxO _.nil))
-(def: extensions/array
+(def: bundle::array
Bundle
- (<| (prefix "array")
- (|> (dict.new text.Hash<Text>)
- (install "new" (unary array//new))
- (install "get" (binary array//get))
- (install "put" (trinary array//put))
- (install "remove" (binary array//remove))
- (install "size" (unary _.vector-length/1))
+ (<| (bundle.prefix "array")
+ (|> bundle.empty
+ (bundle.install "new" (unary array::new))
+ (bundle.install "get" (binary array::get))
+ (bundle.install "put" (trinary array::put))
+ (bundle.install "remove" (binary array::remove))
+ (bundle.install "size" (unary _.vector-length/1))
)))
## [[Numbers]]
-(host.import: java/lang/Double
+(import: java/lang/Double
(#static MIN_VALUE Double)
(#static MAX_VALUE Double))
@@ -173,9 +153,9 @@
Nullary
(<encode> <const>))]
- [frac//smallest Double::MIN_VALUE _.float]
- [frac//min (f/* -1.0 Double::MAX_VALUE) _.float]
- [frac//max Double::MAX_VALUE _.float]
+ [frac::smallest Double::MIN_VALUE _.float]
+ [frac::min (f/* -1.0 Double::MAX_VALUE) _.float]
+ [frac::max Double::MAX_VALUE _.float]
)
(do-template [<name> <op>]
@@ -183,11 +163,11 @@
Binary
(|> subjectO (<op> paramO)))]
- [int//+ _.+/2]
- [int//- _.-/2]
- [int//* _.*/2]
- [int/// _.quotient/2]
- [int//% _.remainder/2]
+ [int::+ _.+/2]
+ [int::- _.-/2]
+ [int::* _.*/2]
+ [int::/ _.quotient/2]
+ [int::% _.remainder/2]
)
(do-template [<name> <op>]
@@ -195,16 +175,16 @@
Binary
(<op> paramO subjectO))]
- [frac//+ _.+/2]
- [frac//- _.-/2]
- [frac//* _.*/2]
- [frac/// _.//2]
- [frac//% _.mod/2]
- [frac//= _.=/2]
- [frac//< _.</2]
+ [frac::+ _.+/2]
+ [frac::- _.-/2]
+ [frac::* _.*/2]
+ [frac::/ _.//2]
+ [frac::% _.mod/2]
+ [frac::= _.=/2]
+ [frac::< _.</2]
- [text//= _.string=?/2]
- [text//< _.string<?/2]
+ [text::= _.string=?/2]
+ [text::< _.string<?/2]
)
(do-template [<name> <cmp>]
@@ -212,66 +192,66 @@
Binary
(<cmp> paramO subjectO))]
- [int//= _.=/2]
- [int//< _.</2]
+ [int::= _.=/2]
+ [int::< _.</2]
)
-(def: int//char (|>> _.integer->char/1 _.string/1))
+(def: int::char (|>> _.integer->char/1 _.string/1))
-(def: extensions/int
+(def: bundle::int
Bundle
- (<| (prefix "int")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary int//+))
- (install "-" (binary int//-))
- (install "*" (binary int//*))
- (install "/" (binary int///))
- (install "%" (binary int//%))
- (install "=" (binary int//=))
- (install "<" (binary int//<))
- (install "to-frac" (unary (|>> (_.//2 (_.float 1.0)))))
- (install "char" (unary int//char)))))
-
-(def: extensions/frac
+ (<| (bundle.prefix "int")
+ (|> bundle.empty
+ (bundle.install "+" (binary int::+))
+ (bundle.install "-" (binary int::-))
+ (bundle.install "*" (binary int::*))
+ (bundle.install "/" (binary int::/))
+ (bundle.install "%" (binary int::%))
+ (bundle.install "=" (binary int::=))
+ (bundle.install "<" (binary int::<))
+ (bundle.install "to-frac" (unary (|>> (_.//2 (_.float 1.0)))))
+ (bundle.install "char" (unary int::char)))))
+
+(def: bundle::frac
Bundle
- (<| (prefix "frac")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary frac//+))
- (install "-" (binary frac//-))
- (install "*" (binary frac//*))
- (install "/" (binary frac///))
- (install "%" (binary frac//%))
- (install "=" (binary frac//=))
- (install "<" (binary frac//<))
- (install "smallest" (nullary frac//smallest))
- (install "min" (nullary frac//min))
- (install "max" (nullary frac//max))
- (install "to-int" (unary _.exact/1))
- (install "encode" (unary _.number->string/1))
- (install "decode" (unary ///runtime.frac//decode)))))
+ (<| (bundle.prefix "frac")
+ (|> bundle.empty
+ (bundle.install "+" (binary frac::+))
+ (bundle.install "-" (binary frac::-))
+ (bundle.install "*" (binary frac::*))
+ (bundle.install "/" (binary frac::/))
+ (bundle.install "%" (binary frac::%))
+ (bundle.install "=" (binary frac::=))
+ (bundle.install "<" (binary frac::<))
+ (bundle.install "smallest" (nullary frac::smallest))
+ (bundle.install "min" (nullary frac::min))
+ (bundle.install "max" (nullary frac::max))
+ (bundle.install "to-int" (unary _.exact/1))
+ (bundle.install "encode" (unary _.number->string/1))
+ (bundle.install "decode" (unary runtime.frac//decode)))))
## [[Text]]
-(def: (text//char [subjectO paramO])
+(def: (text::char [subjectO paramO])
Binary
(_.string/1 (_.string-ref/2 subjectO paramO)))
-(def: (text//clip [subjectO startO endO])
+(def: (text::clip [subjectO startO endO])
Trinary
(_.substring/3 subjectO startO endO))
-(def: extensions/text
+(def: bundle::text
Bundle
- (<| (prefix "text")
- (|> (dict.new text.Hash<Text>)
- (install "=" (binary text//=))
- (install "<" (binary text//<))
- (install "concat" (binary (product.uncurry _.string-append/2)))
- (install "size" (unary _.string-length/1))
- (install "char" (binary text//char))
- (install "clip" (trinary text//clip)))))
+ (<| (bundle.prefix "text")
+ (|> bundle.empty
+ (bundle.install "=" (binary text::=))
+ (bundle.install "<" (binary text::<))
+ (bundle.install "concat" (binary (product.uncurry _.string-append/2)))
+ (bundle.install "size" (unary _.string-length/1))
+ (bundle.install "char" (binary text::char))
+ (bundle.install "clip" (trinary text::clip)))))
## [[Math]]
-(def: (math//pow [subject param])
+(def: (math::pow [subject param])
Binary
(_.expt/2 param subject))
@@ -279,25 +259,25 @@
(-> Text Unary)
(|>> _.global _.apply/1))
-(def: extensions/math
+(def: bundle::math
Bundle
- (<| (prefix "math")
- (|> (dict.new text.Hash<Text>)
- (install "cos" (unary (math-func "cos")))
- (install "sin" (unary (math-func "sin")))
- (install "tan" (unary (math-func "tan")))
- (install "acos" (unary (math-func "acos")))
- (install "asin" (unary (math-func "asin")))
- (install "atan" (unary (math-func "atan")))
- (install "exp" (unary (math-func "exp")))
- (install "log" (unary (math-func "log")))
- (install "ceil" (unary (math-func "ceiling")))
- (install "floor" (unary (math-func "floor")))
- (install "pow" (binary math//pow))
+ (<| (bundle.prefix "math")
+ (|> bundle.empty
+ (bundle.install "cos" (unary (math-func "cos")))
+ (bundle.install "sin" (unary (math-func "sin")))
+ (bundle.install "tan" (unary (math-func "tan")))
+ (bundle.install "acos" (unary (math-func "acos")))
+ (bundle.install "asin" (unary (math-func "asin")))
+ (bundle.install "atan" (unary (math-func "atan")))
+ (bundle.install "exp" (unary (math-func "exp")))
+ (bundle.install "log" (unary (math-func "log")))
+ (bundle.install "ceil" (unary (math-func "ceiling")))
+ (bundle.install "floor" (unary (math-func "floor")))
+ (bundle.install "pow" (binary math::pow))
)))
## [[IO]]
-(def: (io//log input)
+(def: (io::log input)
Unary
(_.begin (list (_.display/1 input)
_.newline/0)))
@@ -306,75 +286,75 @@
(-> Expression Computation)
(_.begin (list code (_.string synthesis.unit))))
-(def: extensions/io
+(def: bundle::io
Bundle
- (<| (prefix "io")
- (|> (dict.new text.Hash<Text>)
- (install "log" (unary (|>> io//log ..void)))
- (install "error" (unary _.raise/1))
- (install "exit" (unary _.exit/1))
- (install "current-time" (nullary (function (_ _) (///runtime.io//current-time (_.string synthesis.unit))))))))
+ (<| (bundle.prefix "io")
+ (|> bundle.empty
+ (bundle.install "log" (unary (|>> io::log ..void)))
+ (bundle.install "error" (unary _.raise/1))
+ (bundle.install "exit" (unary _.exit/1))
+ (bundle.install "current-time" (nullary (function (_ _) (runtime.io//current-time (_.string synthesis.unit))))))))
## [[Atoms]]
-(def: atom//new
+(def: atom::new
Unary
(|>> (list) _.vector/*))
-(def: (atom//read atom)
+(def: (atom::read atom)
Unary
(_.vector-ref/2 atom (_.int 0)))
-(def: (atom//compare-and-swap [atomO oldO newO])
+(def: (atom::compare-and-swap [atomO oldO newO])
Trinary
- (///runtime.atom//compare-and-swap atomO oldO newO))
+ (runtime.atom//compare-and-swap atomO oldO newO))
-(def: extensions/atom
+(def: bundle::atom
Bundle
- (<| (prefix "atom")
- (|> (dict.new text.Hash<Text>)
- (install "new" (unary atom//new))
- (install "read" (unary atom//read))
- (install "compare-and-swap" (trinary atom//compare-and-swap)))))
+ (<| (bundle.prefix "atom")
+ (|> bundle.empty
+ (bundle.install "new" (unary atom::new))
+ (bundle.install "read" (unary atom::read))
+ (bundle.install "compare-and-swap" (trinary atom::compare-and-swap)))))
## [[Box]]
-(def: (box//write [valueO boxO])
+(def: (box::write [valueO boxO])
Binary
- (///runtime.box//write valueO boxO))
+ (runtime.box//write valueO boxO))
-(def: extensions/box
+(def: bundle::box
Bundle
- (<| (prefix "box")
- (|> (dict.new text.Hash<Text>)
- (install "new" (unary atom//new))
- (install "read" (unary atom//read))
- (install "write" (binary box//write)))))
+ (<| (bundle.prefix "box")
+ (|> bundle.empty
+ (bundle.install "new" (unary atom::new))
+ (bundle.install "read" (unary atom::read))
+ (bundle.install "write" (binary box::write)))))
## [[Processes]]
-(def: (process//parallelism-level [])
+(def: (process::parallelism-level [])
Nullary
(_.int 1))
-(def: extensions/process
+(def: bundle::process
Bundle
- (<| (prefix "process")
- (|> (dict.new text.Hash<Text>)
- (install "parallelism-level" (nullary process//parallelism-level))
- (install "schedule" (binary (product.uncurry ///runtime.process//schedule)))
+ (<| (bundle.prefix "process")
+ (|> bundle.empty
+ (bundle.install "parallelism-level" (nullary process::parallelism-level))
+ (bundle.install "schedule" (binary (product.uncurry runtime.process//schedule)))
)))
## [Bundles]
-(def: #export extensions
+(def: #export bundle
Bundle
- (<| (prefix "lux")
- (|> extensions/lux
- (dict.merge extensions/bit)
- (dict.merge extensions/int)
- (dict.merge extensions/frac)
- (dict.merge extensions/text)
- (dict.merge extensions/array)
- (dict.merge extensions/math)
- (dict.merge extensions/io)
- (dict.merge extensions/atom)
- (dict.merge extensions/box)
- (dict.merge extensions/process)
+ (<| (bundle.prefix "lux")
+ (|> bundle::lux
+ (dict.merge bundle::bit)
+ (dict.merge bundle::int)
+ (dict.merge bundle::frac)
+ (dict.merge bundle::text)
+ (dict.merge bundle::array)
+ (dict.merge bundle::math)
+ (dict.merge bundle::io)
+ (dict.merge bundle::atom)
+ (dict.merge bundle::box)
+ (dict.merge bundle::process)
)))
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux
new file mode 100644
index 000000000..b8b2b7612
--- /dev/null
+++ b/stdlib/source/lux/language/compiler/translation/scheme/extension/host.jvm.lux
@@ -0,0 +1,11 @@
+(.module:
+ [lux #*]
+ [///
+ [runtime (#+ Bundle)]
+ [///
+ [extension
+ ["." bundle]]]])
+
+(def: #export bundle
+ Bundle
+ bundle.empty)
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux
index d5dc4541f..01531069e 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/function.jvm.lux
@@ -1,28 +1,30 @@
(.module:
[lux (#- function)
[control
- [monad (#+ do)]
+ ["." monad (#+ do)]
pipe]
[data
- [product]
+ ["." product]
[text
format]
- [collection [list ("list/" Functor<List>)]]]]
- [/////
- [reference (#+ Register Variable)]
- [name]
- [host ["_" scheme (#+ Expression Computation Var)]]
- [compiler ("operation/" Monad<Operation>)
- [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)]
- [synthesis (#+ Synthesis)]]]
- [///]
- [//runtime (#+ Operation Compiler)]
- [//primitive]
- [//reference])
+ [collection
+ ["." list ("list/" Functor<List>)]]]]
+ [//
+ ["." runtime (#+ Operation Compiler)]
+ ["." reference]
+ ["/." //
+ ["//." // ("operation/" Monad<Operation>)
+ [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)]
+ [synthesis (#+ Synthesis)]
+ [//
+ [reference (#+ Register Variable)]
+ ["." name]
+ [host
+ ["_" scheme (#+ Expression Computation Var)]]]]]])
(def: #export (apply translate [functionS argsS+])
(-> Compiler (Application Synthesis) (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[functionO (translate functionS)
argsO+ (monad.map @ translate argsS+)]
(wrap (_.apply/* functionO argsO+))))
@@ -38,7 +40,7 @@
_
(_.letrec (list [@closure
(_.lambda [(|> (list.enumerate inits)
- (list/map (|>> product.left //reference.foreign')))
+ (list/map (|>> product.left reference.foreign')))
#.None]
function-definition)])
(_.apply/* @closure inits))))))
@@ -47,17 +49,17 @@
(def: @missing (_.var "missing"))
(def: input
- (|>> inc //reference.local'))
+ (|>> inc reference.local'))
(def: #export (function translate [environment arity bodyS])
(-> Compiler (Abstraction Synthesis) (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[[function-name bodyO] (///.with-context
(do @
[function-name ///.context]
(///.with-anchor (_.var function-name)
(translate bodyS))))
- closureO+ (monad.map @ //reference.variable environment)
+ closureO+ (monad.map @ reference.variable environment)
#let [arityO (|> arity .int _.int)
@num-args (_.var "num_args")
@function (_.var function-name)
@@ -67,17 +69,17 @@
(_.letrec (list [@function (_.lambda [(list) (#.Some @curried)]
(_.let (list [@num-args (_.length/1 @curried)])
(<| (_.if (|> @num-args (_.=/2 arityO))
- (<| (_.let (list [(//reference.local' +0) @function]))
+ (<| (_.let (list [(reference.local' +0) @function]))
(_.let-values (list [[(|> (list.n/range +0 (dec arity))
(list/map ..input))
#.None]
(_.apply/2 (_.global "apply") (_.global "values") @curried)]))
bodyO))
(_.if (|> @num-args (_.>/2 arityO))
- (let [arity-args (//runtime.slice (_.int 0) arityO @curried)
- output-func-args (//runtime.slice arityO
- (|> @num-args (_.-/2 arityO))
- @curried)]
+ (let [arity-args (runtime.slice (_.int 0) arityO @curried)
+ output-func-args (runtime.slice arityO
+ (|> @num-args (_.-/2 arityO))
+ @curried)]
(|> @function
(apply-poly arity-args)
(apply-poly output-func-args))))
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux
index 4e8d90341..9863cf4ed 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/loop.jvm.lux
@@ -1,40 +1,41 @@
(.module:
[lux (#- Scope)
[control
- [monad (#+ do)]]
+ ["." monad (#+ do)]]
[data
- [product]
+ ["." product]
["." text
format]
[collection
- [list ("list/" Functor<List>)]]]
- [macro]]
- [/////
- [host ["_" scheme (#+ Computation Var)]]
- ["." compiler
- [synthesis (#+ Scope Synthesis)]]]
- [///]
- [//runtime (#+ Operation Compiler)]
- [//reference])
+ ["." list ("list/" Functor<List>)]]]]
+ [//
+ [runtime (#+ Operation Compiler)]
+ ["." reference]
+ ["/." //
+ ["//." //
+ [synthesis (#+ Scope Synthesis)]
+ [//
+ [host
+ ["_" scheme (#+ Computation Var)]]]]]])
(def: @scope (_.var "scope"))
(def: #export (scope translate [start initsS+ bodyS])
(-> Compiler (Scope Synthesis) (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[initsO+ (monad.map @ translate initsS+)
bodyO (///.with-anchor @scope
(translate bodyS))]
(wrap (_.letrec (list [@scope (_.lambda [(|> initsS+
list.enumerate
- (list/map (|>> product.left (n/+ start) //reference.local')))
+ (list/map (|>> product.left (n/+ start) reference.local')))
#.None]
bodyO)])
(_.apply/* @scope initsO+)))))
(def: #export (recur translate argsS+)
(-> Compiler (List Synthesis) (Operation Computation))
- (do compiler.Monad<Operation>
+ (do ////.Monad<Operation>
[@scope ///.anchor
argsO+ (monad.map @ translate argsS+)]
(wrap (_.apply/* @scope argsO+))))
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux
index 6ff146393..9c64aad05 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/primitive.jvm.lux
@@ -2,8 +2,9 @@
[lux (#- i64)]
[/// (#+ State)]
[/////
- [compiler ("operation/" Monad<Operation>)]
- [host ["_" scheme (#+ Expression)]]]
+ [host
+ ["_" scheme (#+ Expression)]]
+ [compiler ("operation/" Monad<Operation>)]]
[//runtime (#+ Operation)])
(def: #export bit
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux
index f9eba9bd7..6828f6d14 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/reference.jvm.lux
@@ -5,15 +5,15 @@
[data
[text
format]]]
- [/////
- [reference (#+ Register Variable Reference)]
- [name]
- [host ["_" scheme (#+ Expression Var)]]
- [compiler ("operation/" Monad<Operation>)
+ [//
+ [runtime (#+ Operation)]
+ [/// ("operation/" Monad<Operation>)
[analysis (#+ Variant Tuple)]
- [synthesis (#+ Synthesis)]]]
- [//runtime (#+ Operation)]
- [//primitive])
+ [synthesis (#+ Synthesis)]
+ [//
+ ["." reference (#+ Register Variable Reference)]
+ ["." name]
+ [host ["_" scheme (#+ Expression Var)]]]]])
(do-template [<name> <prefix>]
[(def: #export <name>
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux
index 961a682f2..a2f2250ef 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux
@@ -7,24 +7,29 @@
[number (#+ hex)]
[text
format]
- [collection [list ("list/" Monad<List>)]]]
- [function]
+ [collection
+ ["." list ("list/" Monad<List>)]]]
+ ["." function]
[macro
- [code]
+ ["." code]
["s" syntax (#+ syntax:)]]]
["." ///
["//." //
[analysis (#+ Variant)]
- [synthesis]
+ ["." synthesis]
[//
- [name]
+ ["." name]
[host ["_" scheme (#+ Expression Computation Var)]]]]])
-(type: #export Operation
- (///.Operation Var Expression Expression))
+(do-template [<name> <base>]
+ [(type: #export <name>
+ (<base> Var Expression Expression))]
-(type: #export Compiler
- (///.Compiler Var Expression Expression))
+ [Operation ///.Operation]
+ [Compiler ///.Compiler]
+ [Handler ///.Handler]
+ [Bundle ///.Bundle]
+ )
(def: prefix Text "LuxRuntime")
diff --git a/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux
index 4637d1a25..1f7f2cf27 100644
--- a/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux
+++ b/stdlib/source/lux/language/compiler/translation/scheme/structure.jvm.lux
@@ -1,31 +1,33 @@
(.module:
[lux #*
- [control [monad (#+ do)]]]
- [/////
- [host
- ["_" scheme (#+ Expression)]]
- ["." compiler
+ [control
+ ["." monad (#+ do)]]]
+ [//
+ ["." runtime (#+ Operation Compiler)]
+ ["." primitive]
+ ["." ///
[analysis (#+ Variant Tuple)]
- [synthesis (#+ Synthesis)]]]
- [//runtime (#+ Operation Compiler)]
- [//primitive])
+ ["." synthesis (#+ Synthesis)]
+ [//
+ [host
+ ["_" scheme (#+ Expression)]]]]])
(def: #export (tuple translate elemsS+)
(-> Compiler (Tuple Synthesis) (Operation Expression))
(case elemsS+
#.Nil
- (//primitive.text synthesis.unit)
+ (primitive.text synthesis.unit)
(#.Cons singletonS #.Nil)
(translate singletonS)
_
- (do compiler.Monad<Operation>
+ (do ///.Monad<Operation>
[elemsT+ (monad.map @ translate elemsS+)]
(wrap (_.vector/* elemsT+)))))
(def: #export (variant translate [lefts right? valueS])
(-> Compiler (Variant Synthesis) (Operation Expression))
- (do compiler.Monad<Operation>
+ (do ///.Monad<Operation>
[valueT (translate valueS)]
- (wrap (//runtime.variant [lefts right? valueT]))))
+ (wrap (runtime.variant [lefts right? valueT]))))
diff --git a/stdlib/source/lux/language/host/scheme.lux b/stdlib/source/lux/language/host/scheme.lux
index e312e769b..bdcd64990 100644
--- a/stdlib/source/lux/language/host/scheme.lux
+++ b/stdlib/source/lux/language/host/scheme.lux
@@ -3,12 +3,13 @@
[control
pipe]
[data
- [number]
+ ["." number]
["." text
format]
[collection
- [list ("list/" Functor<List> Fold<List>)]]]
- [type abstract]])
+ ["." list ("list/" Functor<List> Fold<List>)]]]
+ [type
+ abstract]])
(abstract: Global' {} Any)
(abstract: Var' {} Any)
diff --git a/stdlib/source/lux/language/name.lux b/stdlib/source/lux/language/name.lux
index 0b3dc7bdd..f6489b89c 100644
--- a/stdlib/source/lux/language/name.lux
+++ b/stdlib/source/lux/language/name.lux
@@ -1,7 +1,7 @@
(.module:
[lux #*
[data
- [maybe]
+ ["." maybe]
["." text
format]]])
diff --git a/stdlib/source/lux/language/syntax.lux b/stdlib/source/lux/language/syntax.lux
index 18fd61c8a..ebe2c3511 100644
--- a/stdlib/source/lux/language/syntax.lux
+++ b/stdlib/source/lux/language/syntax.lux
@@ -32,14 +32,14 @@
["ex" exception (#+ exception:)]]
[data
["e" error]
- [number]
- [product]
- [maybe]
+ ["." number]
+ ["." product]
+ ["." maybe]
["." text
["l" lexer]
format]
[collection
- [row (#+ Row)]
+ ["." row (#+ Row)]
["dict" dictionary (#+ Dictionary)]]]])
(type: #export Aliases (Dictionary Text Text))
diff --git a/stdlib/source/lux/language/type.lux b/stdlib/source/lux/language/type.lux
index 11b1e1223..a3ae7aa91 100644
--- a/stdlib/source/lux/language/type.lux
+++ b/stdlib/source/lux/language/type.lux
@@ -5,15 +5,15 @@
[monad (#+ do Monad)]
["p" parser]]
[data
- [text ("text/" Monoid<Text> Equivalence<Text>)]
+ ["." text ("text/" Monoid<Text> Equivalence<Text>)]
[ident ("ident/" Equivalence<Ident> Codec<Text,Ident>)]
[number ("nat/" Codec<Text,Nat>)]
- [maybe]
- [collection [list ("list/" Functor<List> Monoid<List> Fold<List>)]]]
+ ["." maybe]
+ [collection
+ ["." list ("list/" Functor<List> Monoid<List> Fold<List>)]]]
["." macro
- [code]
- ["s" syntax (#+ Syntax syntax:)]]
- ])
+ ["." code]
+ ["s" syntax (#+ Syntax syntax:)]]])
## [Utils]
(def: (beta-reduce env type)
diff --git a/stdlib/source/lux/language/type/check.lux b/stdlib/source/lux/language/type/check.lux
index abd6bda5e..990a0261c 100644
--- a/stdlib/source/lux/language/type/check.lux
+++ b/stdlib/source/lux/language/type/check.lux
@@ -3,18 +3,19 @@
[control
[functor (#+ Functor)]
[apply (#+ Apply)]
- [monad (#+ do Monad)]
+ ["." monad (#+ do Monad)]
["ex" exception (#+ exception:)]]
[data
- [maybe]
- [product]
- [number ("nat/" Codec<Text,Nat>)]
+ ["." maybe]
+ ["." product]
+ ["e" error]
+ ["." number ("nat/" Codec<Text,Nat>)]
[text ("text/" Monoid<Text> Equivalence<Text>)]
[collection
- [list]
- [set (#+ Set)]]
- ["e" error]]
- [language [type ("type/" Equivalence<Type>)]]
+ ["." list]
+ ["." set (#+ Set)]]]
+ [language
+ ["." type ("type/" Equivalence<Type>)]]
])
(exception: #export (unknown-type-var {id Nat})