class Dhall::TypeChecker::Application

Public Class Methods

new(app) click to toggle source
# File lib/dhall/typecheck.rb, line 949
def initialize(app)
        @app = app
        @func = TypeChecker.for(app.function)
        @arg = app.argument
end

Public Instance Methods

annotate(context) click to toggle source
# 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