class Dhall::TypeChecker::OperatorEquivalent

Public Class Methods

new(expr) click to toggle source
# File lib/dhall/typecheck.rb, line 245
def initialize(expr)
        @expr = expr
        @lhs = expr.lhs
        @rhs = expr.rhs
end

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 251
def annotate(context)
        type = TypeChecker.assert_types_match @lhs, @rhs,
                                              "arguments do not match",
                                              context: context

        TypeChecker.assert_type type, Builtins[:Type],
                                "arguments are not terms",
                                context: context

        Dhall::TypeAnnotation.new(
                value: @expr.with(lhs: @lhs.annotate(type), rhs: @rhs.annotate(type)),
                type:  Builtins[:Type]
        )
end