Class: Dhall::TypeChecker::List::AnnotatedList

Inherits:
Object
  • Object
show all
Defined in:
lib/dhall/typecheck.rb

Instance Method Summary collapse

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

#annotationObject



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_typeObject



423
424
425
# File 'lib/dhall/typecheck.rb', line 423

def element_type
	(@alist.first.value&.type || @alist.element_type).normalize
end

#element_typesObject



427
428
429
# File 'lib/dhall/typecheck.rb', line 427

def element_types
	@alist.to_a.map(&:type).map(&:normalize)
end