Class: Dhall::TypeChecker::Record

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

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ Record

Returns a new instance of Record.



561
562
563
# File 'lib/dhall/typecheck.rb', line 561

def initialize(record)
	@record = record
end

Instance Method Details

#annotate(context) ⇒ Object



565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/dhall/typecheck.rb', line 565

def annotate(context)
	arecord = @record.map do |k, v|
		[k, TypeChecker.for(v).annotate(context)]
	end

	Dhall::TypeAnnotation.new(
		value: arecord,
		type:  TypeChecker.for(Dhall::RecordType.for(Hash[
			arecord.record.map { |k, v| [k, v.type] }
		])).annotate(context).value
	)
end