Class: Dhall::TypeChecker::List::AnnotatedList
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::List::AnnotatedList
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotation ⇒ Object
- #element_type ⇒ Object
- #element_types ⇒ Object
-
#initialize(alist) ⇒ AnnotatedList
constructor
A new instance of AnnotatedList.
Constructor Details
#initialize(alist) ⇒ AnnotatedList
Returns a new instance of AnnotatedList.
414 415 416 |
# File 'lib/dhall/typecheck.rb', line 414 def initialize(alist) @alist = alist end |
Instance Method Details
#annotation ⇒ Object
418 419 420 421 |
# File 'lib/dhall/typecheck.rb', line 418 def annotation list = @alist.with(type: Builtins[:List].call(element_type)) Dhall::TypeAnnotation.new(type: list.type, value: list) end |
#element_type ⇒ Object
423 424 425 |
# File 'lib/dhall/typecheck.rb', line 423 def element_type (@alist.first.value&.type || @alist.element_type).normalize end |
#element_types ⇒ Object
427 428 429 |
# File 'lib/dhall/typecheck.rb', line 427 def element_types @alist.to_a.map(&:type).map(&:normalize) end |