#include #include "prelude.h" using std::cout; using std::endl; class Foo {}; int main() { List l = enumFrom(49); cout << monomorphize1,int>(head)( l ) << endl; cout << monomorphize1,char>(head)( l ) << endl; // these are illegal (rightly so) //cout << monomorphize1,char>(head)( l ) << endl; //cout << monomorphize1,Foo>(head)( l ) << endl; Fun1 f= makeFun1( monomorphize1(inc) ); cout << f(49) << endl; Fun1 g= makeFun1( monomorphize1(inc) ); cout << g(49) << endl; Fun1 h= makeFun1( monomorphize1(inc) ); cout << h(49) << endl; Fun2 ff= makeFun2( monomorphize2(Greater()) ); cout << ff( 3, 4 ) << endl; List li = take( 2, l ); Fun2 fp= makeFun2( monomorphize2(Plus()) ); int sum=monomorphize3,int,List,int>( foldr )(fp,0,li); cout << "sum is " << sum << endl; int s = monomorphize2,int>(curry3(foldr,Plus())) (0,li); cout << "sum is " << s << endl; s = bind2of3(foldr,0) (Plus(),li); cout << "sum is " << s << endl; s = bind3of3(foldr,li) (Plus(),0); cout << "sum is " << s << endl; return 0; }