mwotton / hubris Goto Github PK
View Code? Open in Web Editor NEWBridge from Ruby to Haskell
Home Page: shimweasel.com
Bridge from Ruby to Haskell
Home Page: shimweasel.com
Many files have permissions of rw for the root user and group, but no permissions for others, for example
-rw-rw---- 1 root root 175 2009-09-07 20:41 Hubris.rb
Temporary fix seems to be http://www.arthaey.com/tech/support/#Ruby0
Replication:
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "Hubris"
LoadError: no such file to load -- Hubris
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
from (irb):2
When using:
hubris :source => "MyModule.hs"
Modifications to the Haskell file after it has been compiled once do not trigger recompiles.
waiting for BigInts in jhc...
it'd be good to have some examples with benchmarks, hopefully showing an improvement.
Ability to call multi-argument functions from the Ruby side. Requiring all arguments in Ruby-land would be acceptable if it's easier at first IMO.
currently, Hubris needs to know where the ruby headers are when it's installed. this is pretty awkward, and makes it harder to install. It should be possible to defer this to the time that the Hubrify binary is actually run: that way, the running ruby process can pass the configuration information on the command line. Same goes for libruby.so
$ rake spec
uninitialized constant DL::Importer
/Users/jprice/dev/haskell/joshprice-hubris/Rakefile:11
find out how to import functions involving doubles + floats. currently failing on JHC
This may be a problem at my end, but does this package in particular use graphviz's dot, or is that something most ruby packages use?
[agrimm@computername Hubris]$ ruby /usr/local/bin/rake --verbose --trace
(in /home/agrimm/ruby/haskell/Hubris)
which: no dot in (/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/NX/bin:/usr/local/jruby-1.3.0RC1/bin:/home/agrimm/bin:/home/agrimm/.cabal/bin:/usr/NX/bin)
** Invoke default (first_time)
** Invoke spec (first_time)
** Invoke lib/RubyMap.hs (first_time)
** Invoke lib/RubyMap.chs (first_time, not_needed)
** Execute lib/RubyMap.hs
C->Haskell Compiler, version 0.16.0 Crystal Seed, 24 Jan 2009
build platform is "i386-linux" <1, True, True, 1>
In file included from lib/RubyMap.chs.h:1:
lib/rshim.h:4:18: error: ruby.h: No such file or directory
c2hs: Error during preprocessing custom header file
** Execute spec
** Execute default
(googling suggests that dot is a binary belonging to the graphviz diagram drawing tool)
the README install notes say to pull down 6.12.1-rc2. 6.12.1 is on the website now. http://www.haskell.org/ghc/dist/6.12.1/.
It would be nice to also have a mode for binding to binaries on a system where GHC is not present. I may look into this if I get some time.
as of 0.0.1, all steps are manual. It would be better if Hubris made some attempt to map ruby data structures into something haskell-friendly, and vice versa.
also, it should be possible to inline haskell code a la RubyInline or Inline::C in Perl.
if we've already built the dylib, we shouldn't need to build it again.
maybe see how RubyInline does it.
CArray & Bytestring support required - how do we build these libs?
Hubris seems to be passing all of its specs except for the concurrency one. Sometimes it gives a segmentation fault, sometimes it gives a no method exception.
Gist is at http://gist.github.com/217878
currently Hubris only works with JHC because GHC cannot build dynamic libraries. When GHC's capabilities change, add a backend for it.
Hi,
Could you point to a simple example of passing in a Ruby hash?
Thanks.
the mapping layer to libruby is a bit broken.
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- open4 (LoadError)
This was fixed when I gem installed open4.
I received this same failure when I tried to install.
May be my fault, but I'm mentioning it anyway.
[agrimm@laptopname sample]$ ../bin/jhc_builder Test.hs
jhc -dc Test.hs
jhc 0.7.2 (0.7.2-0)
Finding Dependencies...
Using Ho Cache: '/home/agrimm/.jhc/cache'
Main [Test.hs] </.jhc/cache/7f67ff1d5b5b2b5684d09ad92e27a5a5.ho>/.jhc/cache/7f67ff1d5b5b2b5684d09ad92e27a5a5.ho>
Fresh: <
Typechecking...
Compiling...
Collected Compilation...
-- typeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
-- LambdaLift
E
├─case: 11
├─case-alt: 16
├─error: 2
├─lambda: 8
├─let-binding: 10
├─lit: 12
├─other: 10
├─prim: 5
└─var-use: 35
Converting to Grin...
Found 0 CAFs to convert to constants, 0 of which are recursive.
Recursive
Constant
CAFS
Writing "hs.out_code.c"
Running: gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -Wshadow -Wextra -Wall -Wno-unused-parameter -o hs.out hs.out_code.c -DNDEBUG -O3
hs.out_code.c: In function ‘fFE_a__CCall__fibonacci_uhs’:
hs.out_code.c:956: error: expected expression before ‘;’ token
hs.out_code.c:957: error: expected expression before ‘;’ token
user error (C code did not compile.)
cc1: warning: unrecognized gcc debugging option: n
cc1: warning: unrecognized gcc debugging option: m
cc1: warning: unrecognized gcc debugging option: i
cc1: warning: unrecognized gcc debugging option: c
cc1: warning: unrecognized gcc debugging option: l
cc1: warning: unrecognized gcc debugging option: i
cc1: warning: unrecognized gcc debugging option: b
hs.out_code.c:1: warning: The C parser does not support -dy, option ignored
hs.out_code.c: In function ‘fFE_a__CCall__fibonacci_uhs’:
hs.out_code.c:956: error: expected expression before ‘;’ token
hs.out_code.c:957: error: expected expression before ‘;’ token
mv: cannot stat `libdynhs.so': No such file or directory
When installing the gem on Ubuntu, using root gem i hubris, the Hubris code attempts to create /var/hubris, but regular users may not have permission to do this.
Code in lib/hubris.rb wants this:
SO_CACHE = File.expand_path("/var/hubris/cache")
HS_CACHE = File.expand_path("/var/hubris/source")
and then calls FileUtils.mkdir_p for each.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.