~singpolyma/dhall-ruby

b72a988880a741f5eed884a315c14e8dba025591 — Stephen Paul Weber 5 years ago 17029e2
Use Dhall names for everything that encodes untagged
2 files changed, 8 insertions(+), 6 deletions(-)

M lib/dhall/as_dhall.rb
M test/test_as_dhall.rb
M lib/dhall/as_dhall.rb => lib/dhall/as_dhall.rb +4 -2
@@ 6,10 6,12 @@ require "psych"
module Dhall
	module AsDhall
		TAGS = {
			::Integer    => "Integer",
			::Array      => "List",
			::FalseClass => "Bool",
			::Integer    => "Integer",
			::Float      => "Double",
			::Hash       => "Record",
			::Integer    => "Integer",
			::Integer    => "Integer",
			::NilClass   => "None",
			::String     => "Text",
			::TrueClass  => "Bool"

M test/test_as_dhall.rb => test/test_as_dhall.rb +4 -4
@@ 131,12 131,12 @@ class TestAsDhall < Minitest::Test
				"None"    => nil,
				"boop"    => nil,
				"Bool"    => Dhall::Builtins[:Bool],
				"Hash"    => Dhall::RecordType.new(
				"Record"  => Dhall::RecordType.new(
					record: {
						"a" => Dhall::Builtins[:Natural]
					}
				),
				"Array"   => Dhall::Application.new(
				"List"    => Dhall::Application.new(
					function: Dhall::Builtins[:List],
					argument: Dhall::Builtins[:Natural]
				),


@@ 173,10 173,10 @@ class TestAsDhall < Minitest::Test
				Dhall::Union.from(union_type, "boop", nil),
				Dhall::Union.from(union_type, "Bool", Dhall::Bool.new(value: true)),
				Dhall::Union.from(union_type, "Bool", Dhall::Bool.new(value: false)),
				Dhall::Union.from(union_type, "Hash", Dhall::Record.new(
				Dhall::Union.from(union_type, "Record", Dhall::Record.new(
					record: { "a" => Dhall::Natural.new(value: 1) }
				)),
				Dhall::Union.from(union_type, "Array", Dhall::List.new(
				Dhall::Union.from(union_type, "List", Dhall::List.new(
					elements: [Dhall::Natural.new(value: 1)]
				)),
				Dhall::Union.from(union_type, cla_key_a, Dhall::Record.new(