Update examples
This commit is contained in:
2
testsuite/eval/foreign_eval/Makefile
Normal file
2
testsuite/eval/foreign_eval/Makefile
Normal file
@ -0,0 +1,2 @@
|
||||
TOP=../../..
|
||||
include ../../foreign.mk
|
1
testsuite/eval/foreign_eval/README
Normal file
1
testsuite/eval/foreign_eval/README
Normal file
@ -0,0 +1 @@
|
||||
run a string of Haskell code from a C program.
|
0
testsuite/eval/foreign_eval/dont_test
Normal file
0
testsuite/eval/foreign_eval/dont_test
Normal file
1
testsuite/eval/foreign_eval/expected
Normal file
1
testsuite/eval/foreign_eval/expected
Normal file
@ -0,0 +1 @@
|
||||
10946
|
16
testsuite/eval/foreign_eval/main.c
Normal file
16
testsuite/eval/foreign_eval/main.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EvalHaskell.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int *p;
|
||||
hs_init(&argc, &argv);
|
||||
p = hs_eval_i("let fibs = 1:1:zipWith (+) fibs (tail fibs) in fibs !! 20 :: Int");
|
||||
if (p == NULL)
|
||||
printf("failed!\n");
|
||||
else
|
||||
printf("%d\n",*p);
|
||||
hs_exit();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user