Module: Dhall::ExpressionVisitor

Defined in:
lib/dhall/normalize.rb

Constant Summary collapse

ExpressionHash =
Util::HashOf.new(
	ValueSemantics::Anything,
	ValueSemantics::Either.new([Expression, nil])
)

Class Method Summary collapse

Class Method Details

.new(&block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dhall/normalize.rb', line 14

def self.new(&block)
	Visitor.new(
		Expression                    => block,
		Util::ArrayOf.new(Expression) => lambda do |x|
			x.map(&block)
		end,
		ExpressionHash                => lambda do |x|
			Hash[x.map { |k, v| [k, v.nil? ? v : block[v]] }.sort]
		end
	)
end