class Dhall::TypeChecker::LetIn

Public Class Methods

for(letin) click to toggle source
# File lib/dhall/typecheck.rb, line 975
def self.for(letin)
        if letin.let.type
                LetInAnnotated.new(letin)
        else
                LetIn.new(letin)
        end
end
new(letin) click to toggle source
# File lib/dhall/typecheck.rb, line 983
def initialize(letin)
        @letin = letin
        @let = @letin.let
end

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 988
def annotate(context)
        alet = @let.with(type: assign_type(context))
        type = TypeChecker.for(@letin.eliminate).annotate(context).type
        abody = Dhall::TypeAnnotation.new(value: @letin.body, type: type)
        Dhall::TypeAnnotation.new(
                value: @letin.with(let: alet, body: abody),
                type:  type
        )
end

Protected Instance Methods

assign_type(context) click to toggle source
# File lib/dhall/typecheck.rb, line 1000
def assign_type(context)
        TypeChecker.for(@let.assign).annotate(context).type
end