class Dhall::TypeChecker::If::AnnotatedIf
Public Class Methods
new(expr, apred, athen, aelse, context:)
click to toggle source
# File lib/dhall/typecheck.rb, line 177 def initialize(expr, apred, athen, aelse, context:) TypeChecker.assert apred.type, Builtins[:Bool], "If must have a predicate of type Bool" TypeChecker.assert_type athen.type, Builtins[:Type], "If branches must have types of type Type", context: context TypeChecker.assert aelse.type, athen.type, "If branches have mismatched types" @expr = expr.with(predicate: apred, then: athen, else: aelse) end
Public Instance Methods
annotation()
click to toggle source
# File lib/dhall/typecheck.rb, line 188 def annotation Dhall::TypeAnnotation.new( value: @expr, type: @expr.then.type ) end