Class: Dhall::TypeChecker::Optional
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::Optional
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(some) ⇒ Optional
constructor
A new instance of Optional.
Constructor Details
#initialize(some) ⇒ Optional
Returns a new instance of Optional.
469 470 471 |
# File 'lib/dhall/typecheck.rb', line 469 def initialize(some) @some = some end |
Instance Method Details
#annotate(context) ⇒ Object
473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/dhall/typecheck.rb', line 473 def annotate(context) asome = @some.map do |el| TypeChecker.for(el).annotate(context) end some = asome.with(value_type: asome.value.type) type_type = TypeChecker.for(some.value_type).annotate(context).type TypeChecker.assert type_type, Builtins[:Type], "Some type not of type Type, was: #{type_type}" Dhall::TypeAnnotation.new(type: some.type, value: some) end |