Permalink
Browse files

docs & spec task

  • Loading branch information...
1 parent 86b4c2e commit 85f98cba948ee255384ef82a84b5315fa8c6194f @mwotton committed Nov 16, 2009
Showing with 116 additions and 0 deletions.
  1. +21 −0 doc/INSTALL
  2. +74 −0 doc/new_interface.rb
  3. +21 −0 rspec.rake
View
@@ -0,0 +1,21 @@
+This is a bit involved at the moment, because you need to have a development version of GHC,
+as well as having a bootstrapping version of GHC to build it with.
+
+So, on Ubuntu,
+
+sudo apt-get install ruby ruby-dev ghc libopenssl-ruby
+sudo gem install rake open4 rspec hoe
+cabal install c2hs
+wget http://www.haskell.org/ghc/dist/current/dist/ghc-6.11.20090907-src.tar.bz2
+tar -jxvf ghc-6.11.20090907-src.tar.bz2
+cd ghc-6.11.20090907
+# adjust the argument to -j to your number of cores, and the prefix if you need to install somewhere else
+sh boot && ./configure --enable-shared --prefix=/usr/local && make -j 4 && sudo make install
+cd ..
+git clone git://github.com/mwotton/Hubris.git
+cd Hubris
+rake
+# here's where you'll see a whole lot of successes, if you're very lucky
+# There's a good chance you won't. Tell me what went wrong and i'll fix the docs.
+spec spec/*_spec.rb
+
View
@@ -0,0 +1,74 @@
+# IDEAS for new interface
+
+# option 1 (implicit method name from haskell function)
+class MyClass
+ include Hubris
+ def_haskell(code)
+end
+
+# option 2 (explicit method name)
+class MyClass
+ def_haskell(method_name,code)
+end
+
+# option 3 ()
+class Module
+ include Hubris
+end
+
+class MyClass
+ inline_haskell "haskell function"
+end
+
+# option 4 (more humourous)
+class Module
+ include Hubris
+end
+
+class MyClass
+ hubris "haskell function"
+end
+
+#-----------------------------------------
+# include at the module or package level
+#=========================================
+# does importing as_class make sense? no, just include the module
+# when interpreting Haskell module names replace . with ::
+
+# importing std module as a ruby module/class
+hubris :package => "containers", :module => "Data.Map", :as => "Data::Map"
+
+# importing your own module (defaults to module)
+hubris :package => "mypackage", :module => "MyModule" [, :as => "MyModule"]
+
+# implicit package handling (haskell file in my directory)
+hubris :module => "haskell/shit/MyModule"
+
+# simpler to implement option, allows more flexibility in Ruby land
+module MyRubyModule
+ # :packages is optional, just brings in external packages.
+ hubris :module => "Data.Map", :packages => ["containers","foo"]
+ # or
+ hubris :source => "MyHaskellCode.hs" # , :packages => [ ... ]
+ # or
+ hubris :inline => "foo x = x * 2"
+end
+
+
+# alternative
+
+Hubris.import :package => "containers", :module => "Data.Map"
+
+module MyRubyModule
+ include Hubris::Data::Map
+end
+
+# alternative2
+
+module MyRubyModule
+ hubris :package => "containers", :module => "Data.Map"
+end
+
+
+6:34:58 PM Josh Price: class Module; def hubris; self.class_eval { def self.h;"hubrified!";end };end;end
+6:35:10 PM Josh Price: class B;hubris;end
View
@@ -0,0 +1,21 @@
+begin
+ require 'spec'
+rescue LoadError
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
+ require 'spec'
+end
+begin
+ require 'spec/rake/spectask'
+rescue LoadError
+ puts <<-EOS
+To use rspec for testing you must install rspec gem:
+ gem install rspec
+EOS
+ exit(0)
+end
+
+desc "Run the specs under spec/models"
+Spec::Rake::SpecTask.new do |t|
+ t.spec_opts = ['--options', "spec/spec.opts"]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+end

0 comments on commit 85f98cb

Please sign in to comment.