~singpolyma/dhall-ruby

c8b8932b7e6f336d2ca407b14d764755e62c10c3 — Stephen Paul Weber 3 years ago 9cf879f
fix type => [value|element]_type
3 files changed, 12 insertions(+), 12 deletions(-)

M lib/dhall/ast.rb
M lib/dhall/builtins.rb
M lib/dhall/normalize.rb
M lib/dhall/ast.rb => lib/dhall/ast.rb +4 -4
@@ 353,11 353,11 @@ module Dhall
		end

		def first
			OptionalNone.new(value_type: type)
			OptionalNone.new(value_type: element_type)
		end

		def last
			OptionalNone.new(value_type: type)
			OptionalNone.new(value_type: element_type)
		end

		def reverse


@@ 653,7 653,7 @@ module Dhall
			Function.new(
				var:  k,
				type: alternatives.fetch(k),
				body: Union.from(self, tag, Variable[k])
				body: Union.from(self, k, Variable[k])
			).normalize
		rescue KeyError
			block_given? ? yield : (default || raise)


@@ 902,7 902,7 @@ module Dhall
			end

			def headers
				super || EmptyList.new(type: HeaderType)
				super || EmptyList.new(element_type: HeaderType)
			end

			def uri

M lib/dhall/builtins.rb => lib/dhall/builtins.rb +4 -4
@@ 204,7 204,7 @@ module Dhall
					arg.call(
						Variable["List"].call(type),
						cons,
						EmptyList.new(type: type)
						EmptyList.new(element_type: type)
					)
				end
			end


@@ 358,7 358,7 @@ module Dhall
					arg.call(
						Variable["Optional"].call(type),
						some,
						OptionalNone.new(type: type)
						OptionalNone.new(value_type: type)
					)
				end
			end


@@ 369,8 369,8 @@ module Dhall
				Function.of_arguments(
					type,
					body: Optional.new(
						value: Variable["_"],
						type:  type
						value:      Variable["_"],
						value_type: type
					)
				)
			end

M lib/dhall/normalize.rb => lib/dhall/normalize.rb +4 -4
@@ 237,25 237,25 @@ module Dhall

	class List
		def normalize
			super.with(type: nil)
			super.with(element_type: nil)
		end
	end

	class EmptyList
		def normalize
			super.with(type: type.normalize)
			super.with(element_type: element_type.normalize)
		end
	end

	class Optional
		def normalize
			with(value: value.normalize, type: nil)
			with(value: value.normalize, value_type: nil)
		end
	end

	class OptionalNone
		def normalize
			with(type: type.normalize)
			with(value_type: value_type.normalize)
		end
	end