Class: Dhall::TypeChecker::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/dhall/typecheck.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Application

Returns a new instance of Application.



949
950
951
952
953
# File 'lib/dhall/typecheck.rb', line 949

def initialize(app)
	@app = app
	@func = TypeChecker.for(app.function)
	@arg = app.argument
end

Instance Method Details

#annotate(context) ⇒ Object



955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/dhall/typecheck.rb', line 955

def annotate(context)
	afunc = @func.annotate(context)

	TypeChecker.assert afunc.type, Dhall::Forall,
	                   "Application LHS is not a function"

	aarg = TypeChecker.for(
		Dhall::TypeAnnotation.new(value: @arg, type: afunc.type.type)
	).annotate(context)

	Dhall::TypeAnnotation.new(
		value: @app.with(function: afunc, argument: aarg),
		type:  afunc.type.call(aarg.value)
	)
end