More strangeness. I managed to get the function arrow working with this: /////////////////////////////// #import <flx.flxh>
typeclass Arrow[M: TYPE->TYPE->TYPE] { virtual fun arrow[a, b]: (a->b) -> M a b; virtual fun bind[a, b, c]: M a b -> M b c -> M a c; virtual fun first[a, b, c]: M a b -> M (a*c) (b*c); virtual fun second[a, b, c]: M a b -> M (c*a) (c*b); virtual fun parallel[a, b, c, d]: M a c -> M b d -> M (a*b) (c*d); virtual fun split[a, b, c]: M a b -> M a c -> M a (b*c); } typedef fun Fun (a:TYPE) (b:TYPE): TYPE => a->b; instance Arrow[the Fun] { fun arrow[a, b] (f:a->b): a->b => f; fun bind[a, b, c] (f:a->b) (g:b->c): a->c => (fun (x:a) => g $ f x); fun first[a, b, c] (f:a->b) => (fun (x:a, y:c) => (f x, y)) ; fun second[a, b, c] (f:a->b) => (fun (x:c, y:a) => (x, f y)) ; fun parallel[a, b, c, d] (f:a->c) (g:b->d) => (fun (x:a, y:b) => (f x, g y)) ; fun split[a, b, c] (f:a->b) (g:a->c) => (fun (x:a) => (f x, g x)) ; } open Arrow[the Fun]; val x = arrow (fun (x:int) => x + 5); val y = bind x x; proc print (x:int, y:int) { print "("; print x; print ", "; print y; print ")"; } print $ first[int,int,int] x $ (5, 6); endl; print $ second[int,int,int] x $ (5, 6); endl; print $ parallel x y $ (5, 6); endl; print $ split x y $ 5; endl; ///////////////////// But I'm not sure why these need the [int,int,int]: print $ first[int,int,int] x $ (5, 6); endl; print $ second[int,int,int] x $ (5, 6); endl; parallel and split don't seem to need them... ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language