Class: Dhall::Builtins::List_build

Inherits:
Dhall::Builtin show all
Defined in:
lib/dhall/builtins.rb

Instance Method Summary collapse

Methods inherited from Dhall::Builtin

#as_json, #unfill

Methods inherited from Expression

#&, #*, #+, #as_dhall, #cache_key, #concat, decode, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #merge, #normalize, #resolve, #shift, #slice, #substitute, #to_cbor, #to_proc, #to_s, #|

Instance Method Details

#call(arg) ⇒ Object



202
203
204
205
206
207
208
209
210
# File 'lib/dhall/builtins.rb', line 202

def call(arg)
	fill_or_call(arg) do
		arg.call(
			List.new.call(type),
			cons,
			EmptyList.new(element_type: type)
		)
	end
end

#fusion(*args) ⇒ Object



191
192
193
194
195
196
197
198
199
200
# File 'lib/dhall/builtins.rb', line 191

def fusion(*args)
	_, arg, = args
	if arg.is_a?(Application) &&
	   arg.function.is_a?(Application) &&
	   arg.function.function == List_fold.new
		arg.argument
	else
		super
	end
end