A Bag is a data structure, like a list, that stores items with no concept of order. The only operations on the structure is to add an item and then iterate through the items with no guarantee as to the order of iteration. We see it in Sedgewick's Algorithms book. This has to be a Monad, as it is a data structure, and it could be Comonad or it could not be. What is the Monad for the bag? Is it a Comonad?
What is the (Co)Monad for a Bag
Ben Sprott
- 1.3k
- 14
- 23