[Haskell-cafe] Re: monad . comonad = id
es at ertes.de
Fri May 8 09:58:08 EDT 2009
the principle of duality in category theory is not like "being the
inverse", but more like "stating the same somewhere else". To each
category there is an opposite category, which is just the same, but with
all arrows flipped. A comonad in the original category is then a monad
in the corresponding opposite category.
Jan Christiansen <jac at informatik.uni-kiel.de> wrote:
> 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
nightmare = unsafePerformIO (getWrongWife >>= sex)
More information about the Haskell-Cafe