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.
That's not true.
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))
First of all, this is NOT a comonad. The term "comonad" doesn't refer just to instances of Comonad class, it refers to instances that satisfy
several laws.
Secondly, "[]" is a monad, and there is an instance of Monad class for it. It's
working; don't fix it.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe