
Conal Elliott wrote:
i'm missing a piece of reasoning. how about having &&& as primitive as in your Cartesian proposal, but without the fst/&&& and snd/&&& laws? you could still introduce those laws in a subclass that does not include Arrow.
That would make me feel uncomfortable. At least, I'd drop the name "Cartesian" which intends to allude to "cartesian category". I can't quite put my finger on it, but I think it's the following: since &&& is somewhat abstract, the best way to characterize it is by laws. I mean, it's the same for monads and return . The fact that return has no side-effects is captured in its entirety by the laws return x >>= f = f x m >>= return = m In other words, return is determined uniquely by those two laws. Likewise, the three laws for fst, snd and &&& uniquely determine (up to isomorphism) the notion of "cartesian product" in any category (see also http://en.wikipedia.org/wiki/Product_%28category_theory%29). If those laws don't hold, I think the most compelling characterization of &&& is indeed in terms of the decomposition f &&& g = first f . second g and laws for the new primitives first and second like first f . first g = first (f . g) second f . second g = second (f . g) and others. fst . first f . dup = f snd . second f . dup = f snd . first f . dup = fst . second f . dup ... It's already tricky to list them all, how to express the fact that first and second pass the other value intact while still performing a potential side effect? And what about a minimal (but still complete) amount of laws? Regards, apfelmus