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.



1357
1358
1359
1360
# File 'lib/dhall/typecheck.rb', line 1357

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

Class Method Details

.for(builtin) ⇒ Object



1347
1348
1349
1350
1351
1352
1353
1354
1355
# File 'lib/dhall/typecheck.rb', line 1347

def self.for(builtin)
	if builtin.is_a?(Dhall::BuiltinFunction)
		if (unfilled = builtin.unfill) != builtin
			return TypeChecker.for(unfilled)
		end
	end

	new(builtin)
end

Instance Method Details

#annotateObject



1362
1363
1364
1365
1366
1367
1368
1369
# File 'lib/dhall/typecheck.rb', line 1362

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