Class: Dhall::TypeChecker::List
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::List
- Defined in:
- lib/dhall/typecheck.rb
Defined Under Namespace
Classes: AnnotatedList
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(list) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(list) ⇒ List
Returns a new instance of List.
401 402 403 |
# File 'lib/dhall/typecheck.rb', line 401 def initialize(list) @list = list end |
Instance Method Details
#annotate(context) ⇒ Object
424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/dhall/typecheck.rb', line 424 def annotate(context) alist = AnnotatedList.new(@list.map(type: @list.element_type) { |el| TypeChecker.for(el).annotate(context) }) TypeChecker.assert alist.element_types, Util::ArrayOf.new(alist.element_type), "Non-homogenous List" TypeChecker.assert_type alist.element_type, Dhall::Variable["Type"], "List type not of type Type", context: context alist.annotation end |