by Conor on July 8, 2007.
Tagged as: Lunches.
Lists are applicative with a zipping-truncating behaviour, but these guys (written backwards, today)
are applicative with a zipping-padding behaviour. Like this
They're also happily monadic in the nondeterministic sense. Moreover, the join
is structurally recursive (if you know what you're doing) and structurally corecursive, unlike the obvious candidate for join on CoList.
So these guys, as data or codata, get to be monadic hence applicative, but also (and differently) zip-max applicative. The padding behaviour is useful for making rectangular text boxes.
Note that Paddy is not Alternative because, like Ernst Stavro Blofeld, he doesn't tolerate failure.
However, Paddy is also comonadic.
That's to say, thinking of these things temporally, each entry in the output to a cobind at a given time is given by the history of the input up to that time. Computations can't do more, but they can be more, by being in context. Again, note productivity means the codata version is also comonadic.
Reminder: lists, colists, etc are not instances of the free/completely iterative monad/comonad construction, as they have node information rather than leaf information, and are additive. Amusing, then, that they are so well behaved.