Multicategories vs. monoidal categories

I just realized why you might want to have a multicategory with a monoidal structure on it, such that multi-maps A,B,C \to D are equivalent to maps A \otimes B \otimes C \to D. It seems like this is redundant; why not just call “multi-argument functions” by passing tuples of their arguments in?

Well, one answer is that tuple types have to have a fixed memory layout, but you might want the flexibility to use a different calling convention based on the input types. I.e., when compiling higher order functions like map or filter, you might want to actually inline part of the function that is being passed in, so that, say, map(x -> x + 1, [1,2,3]) is as efficient as a for loop.

I don’t know if this is important, but I like this as another example of “up to equivalence is not good enough when you want to implement.”

1 Like