Wednesday 15 April 2015

functional programming - Scala comonads; Comonad laws? -


So a comonad (see below) has the above rules right above this encoding? For some reason I do not think they are considering them, and I know that due to the wrong way growing from there only bad roads will be generated, so I appreciate the nudge, stir, signal, help Is nearby >

  / ** * Note: I think these are correct * Commodore Lows * * (I) Cowit (Cosine (M)) == M * * (ii)> gt; & Gt; (Cowit (M)) (Cojoin) == M * * (iii) Sahajr (cojoin (m)) ==> & Gt; (Cojoin (m)) (cojoin) * * / feature Comonad [M [_]] {// map def & Gt; [A, B] (A: M [A]) (F: A = & gt; B): B / extract | Kota Def County [A] (A: M [A]): ​​A // Kobind | = & Lt; & Lt; | Expand the Duff coflatMap [A, B] (MA: M [A]) (F: M [A] => B): M [B] / coflatten | Comu def cojoin [A] (A: M [A]): ​​M [M [A]]}    

You are almost there both, (i) and (iii) are correct, but (ii) is incorrect Can find fault because (ii) is not typed properly: & gt; & Gt; (For Descriptive) Logic Country (M) is the right law for your code:

     * (I) Nation (Cosine (M)) == M * * (ii)> & gt; (Cosine (m)) (cout) == M * * (iii) cosine (cosine (m)) ==>  (i)  and  (ii)  For both,   

The law is that the map of status or counit The identification function for "the result of cojoin is equivalent to".

No comments:

Post a Comment