So I decided the best way to learn about arrows is to try to implement
them. However, I'm running into some problems. I've got the
preliminary typeclass implemented here:

#import <flx.flxh>

fun swap[A, B] (a:A, b:B): (B*A) => (b, a);

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 foo[a, b, c] (f:M a b): M (a*c) (c*a) =>
    arrow (the swap[a, c])
  ;
}

But felix doesn't like this, and reports this:

//Parsing Implementation std.flx
//Parsing Implementation main.flx
Questionable meta typing of term: <T4563> * <T4565>
Questionable meta typing of term: <T4577> * <T4575>
Questionable meta typing of term: <T4587> * <T4589>
CLIENT ERROR
In return (arrow the swap[a, c]);
Wrong return type,
expected : (<T4537:(TYPE 0 -> (TYPE 0 -> TYPE 0))> (<T4587> *
<T4589>)) (<T4589> * <T4587>)
but we got (<T4537> (<T4587> * <T4589>)) (<T4589> * <T4587>)
In ./main.flx: line 12 col 3 to  line 14 col 3
11:
12:   virtual fun foo[a, b, c] (f:M a b): M (a*c) (c*a) =>
13:     arrow (the swap[a, c])
14:   ;
15: }



There are three things I see here. First, why is this type
questionable? It'd be a little easier to read the return type if my
named abstract types were used instead of the <T4563> style names. Not
sure how practical that is though. Third, aren't these the same times?

-------------------------------------------------------------------------
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

Reply via email to