I'd like to develop, if there is not one already, an interface between R
code and Haskell code, to allow R code to call Haskell (compiled) code, and
vice-versa.  But in the interest of not reinventing the wheel, does anyone
on this list know of existing bindings for Haskell code?

There is support for loading plugins in Haskell, and for an eval() like set
of functions provided by the Haskell hs-plugin package that evaluates
arbitrary strings in the IO monad.
http://www.cse.unsw.edu.au/~dons/hs-plugins/paper/ describes this
functionality. For example:

#include <stdio.h>
#include "RunHaskell.h"

int main(int argc, char *argv[]) {
 int *p;
 hs_init(&argc, &argv);
 p = hs_eval_i("foldl1 (+) [0 .. 10]"); /* this is Haskell code */
 printf("%d\n", *p); hs_exit();
}



That said, i don't think it will be that difficutl.  But I imagine the
hardest part of this will be getting the memory management for garbage
collection right. I thought I would start by looking at how the rJava or
rJython packages handle memory. If anyone has pointers or advice on
integrating R's garbage collection with another language's garbage
collection, I'd welcome suggestions and warnings about pitfalls.

Thanks,
Jason

-- 
Jason E. Aten, Ph.D.
j.e.a...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to