Tuesday, 15 May 2012

dart - typedef for map from M to M -


Dart is working on a learning library called "Daphankt" and I am trying to express a function that is wrapped in a wrapped A ma) and after applying one to b, gives rap b (MB) , Ensuring that the type of cover is the same.

  typedef r func1 < T, R & gt; ( 

T input); // & lt; - is included for completeness, but related Typedf M & lt; B & gt; Lift & lt; M. Monad, A, B & gt; (M & T; A & gt; source, funk 1 & lt; a, b & gt; map); Typedef Mb lift & lt; M Monad expands, MA & LT; A, A, MB Extended M & LT; B & gt ;, B & gt; (Ma source, funk 1 and lieutenant; a, b & gt; map);

- I am creating due to less expressive type in the mean time but it lacks any kind of guards, who say that 'M' B is being provided as a source And this is not to protect the result of 'M of B' in the implementation:

  typed thefifferent lift & lt; M Monad, A, B & gt; (M source, funk 1 and lt; a, b & gt; map);   

- If there is another way of expressing it ... I remember ...?

Both of these are incorrect:

  Typedef m & lt; B & gt; Lift & lt; M. Monad, A, B & gt; (M & T; A & gt; source, funk 1 & lt; a, b & gt; map); Typedef Mb lift & lt; M Monad expands, MA & LT; A, A, MB Extended M & LT; B & gt ;, B & gt; (Ma source, funk 1 and lieutenant; a, b & gt; map);    

The problem is that you are saying that M is a type of variable, and type variables do not take any arguments then you can not write:

  M & LT; A & gt;   

Why is that so? In summary, the answer is that the actual value of M can be sub-class of monad, which does not have type parameters (or there are more types of criteria than monad).

Then you can express the "best" type:

  Type Diff R lift & lt; A, B, M. Monad & lt; A & gt ;, R increases Monad & lt; B & gt; & Gt; (M Source, Phanak 1 and Lt; A, B & gt; Map);   

My recommendation is not to try it, it will be very easy to use:

  typed mont & lt; B & gt; Lift & lt; A, B & gt; (Monad & lt; a & gt; source, funk 1 & lt; a, b & gt; map);   

Please note that the type rules in Dart are sufficiently loose, so you can use any sub-class of Monad.

No comments:

Post a Comment