So, given this encoding of the comonad (see below), are the laws of the comonad over it correct? for some reason, I donβt think they are looking at them, and I know that this will not turn out a bad way, so I will be grateful for the push, hint, help, answer that you have.
/** * note: I think these are right * Comonad Laws * * (i) counit(cojoin(m)) == m * * (ii) >>(counit(m))(cojoin) == m * * (iii) cojoin(cojoin(m)) == >>(cojoin(m))(cojoin) * */ trait Comonad[M[_]] { // map def >>[A,B](a: M[A])(f: A => B): B // extract | coeta def counit[A](a:M[A]): A // cobind | =<< | extend def coflatMap[A,B](ma:M[A])(f: M[A] => B): M[B] // coflatten | comu def cojoin[A](a: M[A]): M[M[A]] }
user1888498
source share