Seems like I was wrong. It does satisfy comonad laws. Sorry.
However, the "duality" of monads and comonads isn't that simple. A comonad is actually a monad itself, but in different category. It has nothing
to do with inverse functions etc.
Jan Christiansen wrote on 08.05.2009 14:47:
Hi,
I have a question regarding the connection between monads and comonads.
I always thought of the comonad operations as being the inverse
operations of the corresponding monad functions. As I do not know the
underlying theory I thought I simply ask the masters.
Is there a formal verification for this intuition? That is, are there
always corresponding instances for monad and comonad such that the
following laws are satisfied?
extract . return == id
join . duplicate == id
If this is the case I would like to know what the corresponding monad
for the following comond could be. This comonad treats lists as pointed
sets where the first element is focused.
instance Comonad [] where
extract = head
duplicate xs = init (zipWith (++) (tails xs) (inits xs))
Obviously we can define return x = [x]. But I do not know how to define
join.
Cheers, Jan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe