M lib/dhall/coder.rb => lib/dhall/coder.rb +1 -1
@@ 117,7 117,7 @@ module Dhall
refine Function do
def to_ruby(&decode)
- ->(*args) { decode[expr.call(*args)] }
+ ->(*args) { decode[call(*args)] }
end
end
M test/test_coder.rb => test/test_coder.rb +8 -0
@@ 155,6 155,14 @@ class TestCoder < Minitest::Test
end
end
+ def test_decode_proc
+ coder = Dhall::Coder.new(safe: [Proc, NilClass, Integer])
+ assert_equal(
+ 2,
+ coder.decode(Dhall.load("\\(x: Natural) -> x + 1").sync).call(1)
+ )
+ end
+
class Custom
attr_reader :a, :b