【文件属性】:
文件名称:Ruby:使用另一个进程在 Ruby 中执行 Haskell
文件大小:7KB
文件格式:ZIP
更新时间:2021-06-30 16:53:31
Ruby
Ruby 上的 Haskell
需要 GHC
require 'haskell'
# Invoke sandbox for executing ghc
Haskell . invoke_sandbox! ( File . expand_path ( '../' , __FILE__ ) )
Haskell . compile <<-HASKELL
add :: Integer -> Integer -> Integer
add x y = x + y
result = add 1 2
HASKELL
while Haskell . compiling?
# wait for....
end
p Haskell . execute
#=> 3
# Don't forget to revoke sandbox
Haskell . revoke_sandbox!
【文件预览】:
Ruby-master
----rubype.gemspec(910B)
----LICENSE.txt(1KB)
----lib()
--------haskell.rb(2KB)
--------haskell()
----Gemfile(49B)
----Rakefile(130B)
----.travis.yml(80B)
----test()
--------minitest_helper.rb(105B)
--------haskell_codes()
--------test_haskell.rb(1022B)
----README.md(401B)
----.gitignore(118B)
----bin()
--------rubype(39B)