[Haskell-cafe] Re: N and R are categories, no?

Steve Downey sdowney at gmail.com
Mon Mar 19 18:57:25 EDT 2007

Thanks! Somehow, the,  now blindingly obvious, fact that a monad must
be a mapping into (not onto, right, at least in general?) is something
I had missed, although it did lead me to be puzzled about join.

So, although you could have a functor from N to R, there is no way it
could be a monad.

In Haskell, it would be Integer instead of N, since the category we
deal with for Haskell Monads are Haskell types.

Does a typeclass, like Num or Eq, form a category? I know that you
can't restrict an instance of Monad to be only over a particular
typeclass, but could I have an EqMonad, with all of the non-sugar
properties of Monad?

On 3/15/07, Ulf Norell <ulfn at cs.chalmers.se> wrote:
> On 3/15/07, Steve Downey <sdowney at gmail.com> wrote:
> >
> > EOk, i'm trying to write down, not another monad tutorial, because I
> > don't know that much yet, but an explication of my current
> > understanding of monads.
> >
> > But before I write down something that is just flat worng, I thought
> > I'd get a cross check. (and I can't get to #haskell)
> >
> > Monads are Functors. Functors are projections from one category to
> > another such that structure is preserved. One example I have in mind
> > is the embedding of the natural numbers into the real numbers. The
> > mapping is so good, that we don't flinch at saying 1 == 1.0.
> Monads are endofunctors (functors from one category to itself). This is easy
> to see from the type of join:
> join : m (m a) -> m a
> For Haskell monads the category is the category of Haskell types and Haskell
> functions. In this category N and R are objects, so you'll get the wrong
> idea trying to see them as categories.
> / Ulf

More information about the Haskell-Cafe mailing list