class Dhall::TypeChecker::Function

Public Class Methods

new(func) click to toggle source
# File lib/dhall/typecheck.rb, line 924
def initialize(func)
        @func = func
        @type = Dhall::Forall.new(
                var:  func.var,
                type: func.type,
                body: Dhall::Variable["UNKNOWN"]
        )
        @output = TypeChecker.for(func.body)
end

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 934
def annotate(context)
        abody = @output.annotate(context.add(@type))

        Dhall::TypeAnnotation.new(
                value: @func.with(body: abody),
                type:  TypeChecker.for(
                        @type.with(body: abody.type)
                ).annotate(context).value
        )
end