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.
436 437 438 |
# File 'lib/dhall/typecheck.rb', line 436 def initialize(some) @some = some end |
Instance Method Details
#annotate(context) ⇒ Object
440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/dhall/typecheck.rb', line 440 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 |