Class: Dhall::TypeChecker::Builtin

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builtin) ⇒ Builtin

Returns a new instance of Builtin.



1220
1221
1222
1223
# File 'lib/dhall/typecheck.rb', line 1220

def initialize(builtin)
	@expr = builtin
	@name = builtin.as_json
end

Class Method Details

.for(builtin) ⇒ Object



1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/dhall/typecheck.rb', line 1211

def self.for(builtin)
	unfilled = builtin.unfill
	if unfilled != builtin
		TypeChecker.for(unfilled)
	else
		new(builtin)
	end
end

Instance Method Details

#annotateObject



1225
1226
1227
1228
1229
1230
1231
1232
# File 'lib/dhall/typecheck.rb', line 1225

def annotate(*)
	Dhall::TypeAnnotation.new(
		value: @expr,
		type:  BUILTIN_TYPES.fetch(@name) do
			raise TypeError, "Unknown Builtin #{@name}"
		end
	)
end