From 453ab9f67873bb022acadf4c0f5c1e635c7d5794 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 11 Aug 2018 23:27:32 -0400 Subject: - Fixed common translation tests for JVM. - Fixed a bug in "lux text <". - Small optimizations to old LuxC. --- .../lux/compiler/default/phase/synthesis.lux | 34 ++++++++++++++++++++-- stdlib/source/lux/math/random.lux | 3 +- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'stdlib/source') 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)] + ["." dictionary (#+ Dictionary)]]]] ["." // ["." analysis (#+ Environment Arity Analysis)] ["." extension (#+ Extension)] @@ -21,7 +24,7 @@ (def: #export fresh-resolver Resolver - (dict.new reference.Hash)) + (dictionary.new reference.Hash)) (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 [ ] + (^ ( value)) + ( 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."} -- cgit v1.2.3