Is "initial Partial Fragment" of Lists a Comonad?

53 Views Asked by At

Lists can be captured as Monads, where the product axiom is given as concatenation. Given a list $l = Concat(l_1, l_2)$, where $Concat$ is the concatenation of two lists, we say that $l_1$ is an initial partial fragment of $l$. For any list $l$, there is a list of lists of initial partial fragments. For example, let $P : List \rightarrow List \cdot List$ be a natural transformation that takes the $List$ functor to its composition with itself.

$$P : [a,b,c] \rightarrow [[a], [a,b]]$$

Does this convert the List monad into a bimonad, where P is the coproduct natural transformation?

I think the problem is that I cannot imagine a counit. Perhaps a good counit is the following:

$$\eta : [l_1,l_2,l_3] \rightarrow l_3$$

ie, it picks out the last element.

Note: It has been pointed out that you cannot have a counit because there is no map on the empty list. To resolve this, I want to use the non-empty list monad that is mentioned in this post