[Haskell-cafe] Relevance and applicability of category theory
miguelimo38 at yandex.ru
Wed Jan 30 19:59:02 EST 2008
> 1. Are Haskell monads useful in a truly categorical sense?
> 2. Is Haskell's functor class misnamed?
> 3. Haskell arrows and Haskell monads have a misleading relationship
I'm confused. It seems for me that either I don't understand math or I
don't understand you.
> 1. Categorical monads are a class of functors, that is, morphisms on
> Cat. Haskell's monads are at least a bit closer to the categorical
> idea than Haskell's functors by virtue of having the same domain and
> codomain: Hask -> Hask. I think applicability of Haskell monads
> beyond sequencing computation, and the validity of their definition,
> would be much more clear if someone explained the meaning of adjoint
> functors to and from Hask. In other words, provide the mathematical
> characterization to make Haskell monads a precise representation of
> categorical monads on Hask.
Well, Haskell monad, you know, consists of three parts: 1) a map
m:Ob(Hask) -> Ob(Hask) (by Ob I mean the class of objects of a
category); 2) a morphism X -> m(X) for all X's, and 3) a map from
Hask(X,m(Y)) to Hask(m(X),m(Y)) - that is, from the set of morphisms X-
>m(Y) to the set of morphisms m(X)->m(Y) - for all X's and Y's. That
is, I believe, what's called a 'Kleisli triple' in math; it's well
known that Kleisli triples are equivalent to monads (in mathematical
> 2. Functors are structure preserving maps in the category Cat. The
> Haskell Functor class represents structure preserving maps in the
> category Hask
What do you mean? A Haskell Functor, first of all, maps types to types
- that is, objects of Hask to objects of Hask. Therefore, it becomes a
math functor from Hask to Hask.
> 3. I believe the documentation stating that Haskell arrows are a
> generalization of Haskell monads, but arrows are a categorical thing
> too and in that context bear a much more distant relationship to
> monads. Does a Haskell arrow have Hask as domain and codomain?
Of course not. They have Haskell objects as domains and codomains. I
mean, by defining an Arrow class, you really define another category,
which has the same objects as Hask, but different morphisms (arrows).
> Or is one particular element in Hask its domain and possibly
> another its codomain?
What do you mean by 'element in Hask'? Hask is a category, it has
objects, it has morphisms (arrows), but elements?
More information about the Haskell-Cafe