aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2018-08-11 23:27:32 -0400
committerEduardo Julian2018-08-11 23:27:32 -0400
commit453ab9f67873bb022acadf4c0f5c1e635c7d5794 (patch)
treefa2419e2bb78b37e75f2ac070e0916776116638d /stdlib
parent425148d29846ba507599b220d4df05c805e8d38a (diff)
- Fixed common translation tests for JVM.
- Fixed a bug in "lux text <". - Small optimizations to old LuxC.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/compiler/default/phase/synthesis.lux34
-rw-r--r--stdlib/source/lux/math/random.lux3
-rw-r--r--stdlib/test/tests.lux9
3 files changed, 38 insertions, 8 deletions
diff --git a/stdlib/source/lux/compiler/default/phase/synthesis.lux b/stdlib/source/lux/compiler/default/phase/synthesis.lux
index 29c2189c3..bf60c9798 100644
--- a/stdlib/source/lux/compiler/default/phase/synthesis.lux
+++ b/stdlib/source/lux/compiler/default/phase/synthesis.lux
@@ -3,8 +3,11 @@
[control [monad (#+ do)]]
[data
[error (#+ Error)]
+ ["." text
+ format]
[collection
- ["dict" dictionary (#+ Dictionary)]]]]
+ [list ("list/." Functor<List>)]
+ ["." dictionary (#+ Dictionary)]]]]
["." //
["." analysis (#+ Environment Arity Analysis)]
["." extension (#+ Extension)]
@@ -21,7 +24,7 @@
(def: #export fresh-resolver
Resolver
- (dict.new reference.Hash<Variable>))
+ (dictionary.new reference.Hash<Variable>))
(def: #export init
State
@@ -268,3 +271,30 @@
[function/abstraction #..Function #..Abstraction]
[function/apply #..Function #..Apply]
)
+
+(def: #export (%synthesis value)
+ (Format Synthesis)
+ (case value
+ (^template [<pattern> <format>]
+ (^ (<pattern> value))
+ (<format> value))
+ ([..bit %b]
+ [..f64 %f]
+ [..text %t])
+
+ (^ (..i64 value))
+ (%n (.nat value))
+
+ (^ (..variant [lefts right? content]))
+ (|> (%synthesis content)
+ (format (%n lefts) " " (%b right?) " ")
+ (text.enclose ["(" ")"]))
+
+ (^ (..tuple members))
+ (|> members
+ (list/map %synthesis)
+ (text.join-with " ")
+ (text.enclose ["[" "]"]))
+
+ _
+ "???"))
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux
index eab1ae04c..92eced24d 100644
--- a/stdlib/source/lux/math/random.lux
+++ b/stdlib/source/lux/math/random.lux
@@ -25,8 +25,7 @@
[tree
["." finger (#+ Tree)]]]]
[type
- [refinement (#+ Refiner Refined)]]
- ])
+ [refinement (#+ Refiner Refined)]]])
(type: #export #rec PRNG
{#.doc "An abstract way to represent any PRNG."}
diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux
index 702f7f342..572a69e02 100644
--- a/stdlib/test/tests.lux
+++ b/stdlib/test/tests.lux
@@ -42,6 +42,7 @@
[compiler
[host
[".H" scheme]]
+ ["._" cli]
["._" default
["._" evaluation]
[phase
@@ -58,15 +59,15 @@
["._scheme" expression]]]
[extension
["._" statement]]]
- ["._default" cache]
- [repl
- ["._" type]]]
+ ["._default" cache]]
[meta
["._meta" io
["._meta_io" context]
["._meta_io" archive]]
["._meta" archive]
- ["._meta" cache]]]]
+ ["._meta" cache]]]
+ ["._" interpreter
+ ["._interpreter" type]]]
## TODO: Must have 100% coverage on tests.
[test
["_." lux]