[Rd] R <-> Haskell

Gabor Grothendieck ggrothendieck at gmail.com
Sun Dec 12 04:19:20 CET 2010

On Sat, Dec 11, 2010 at 9:04 PM, Jason E. Aten <j.e.aten at gmail.com> wrote:
> 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.

You might look at:


Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

More information about the R-devel mailing list