~singpolyma/dhall-ruby

9984f6362eaa3e494aed8ddae801443456aab56a — Stephen Paul Weber 3 years ago a7a8593
Useful helper for the common typecheck cases
1 files changed, 6 insertions(+), 2 deletions(-)

M lib/dhall/typecheck.rb
M lib/dhall/typecheck.rb => lib/dhall/typecheck.rb +6 -2
@@ 40,9 40,13 @@ module Dhall
			@typecheckers[node_type] ||= [typechecker, extras]
		end

		def self.type_of(expr)
		def self.annotate(expr)
			return if expr.nil?
			TypeChecker.for(expr).annotate(TypeChecker::Context.new).type
			TypeChecker.for(expr).annotate(TypeChecker::Context.new)
		end

		def self.type_of(expr)
			annotate(expr)&.type
		end

		class Context