blob: 6103874fb950025e4887f7d2401312dce6face1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
typedef int (* IntFun)(int a, int b);
int apply_fun(int n, IntFun f, int a, int b) {
int s = 0;
int i;
for (i = 0; i < n; i++) {
// Each call back into Haskell using f dereferences a stable pointer
s += f(a, b + i);
}
return s;
}
|