[Haskell-cafe] Re: Category theory monad <----> Haskell monad
Cale Gibbard
cgibbard at gmail.com
Mon Aug 22 17:32:12 EDT 2005
On 22/08/05, Chung-chieh Shan <ccshan at post.harvard.edu> wrote:
> Michael Vanier <mvanier at cs.caltech.edu> wrote in article <20050819054742.5C785103BE4 at orchestra.cs.caltech.edu> in gmane.comp.lang.haskell.cafe:
> > Basically, though, the Haskell implementation _is_ the category theoretic
> > definition of monad, with bind/return used instead of (f)map/join/return as
> > described below.
>
> Doesn't the Haskell implementation really correspond to the notion of a
> strong monad in category theory, once we take into account the fact that
> free variables can occur anywhere in the arguments to bind and return?
>
Well, I had a look at the definition of strong monad. It seems that
for the obvious symmetric monoidal structure given by (,) any Haskell
monad admits the following strength, making it a strong monad:
strength :: (Monad m) => (a, m b) -> m (a,b)
strength (x, xs) = xs >>= (\a -> return (x,a))
It's less clear to me that any symmetric monoidal structure on the
category of Haskell types admits a strength for any Haskell monad.
It's also not so clear that it will always be unique. (This would be
fairly interesting)
Even if this is so, since Haskell monads don't come with a strength
pre-defined, I'd hesitate to call them "strong" in the same way that
I'd hesitate to call a metrisable topological space a metric space:
the information isn't attached to begin with.
- Cale
More information about the Haskell-Cafe
mailing list