6
$\begingroup$

In the list monad, your map $TT \rightarrow T$ takes a list of lists and concatenates them to form a list. There is another way to take a list of lists and create a list, which is to shuffle randomly the two lists together. You can also imagine taking a list of lists and mapping that to a set of every shuffle. I do not think you can create a Monad with this map because there is a number of ways to shuffle two lists. I guess I want to know if there is a shuffle monad, or how would you model this with functors and natural transformations? Interestingly, people doing functional programming have done something like this

http://www.drmaciver.com/2008/04/monadic-card-shuffling/

$\endgroup$
1
  • 1
    $\begingroup$ There exists an operad closely related to the shuffle product, usually called the Zinbiel operad. $\endgroup$ – F. C. Jul 29 '16 at 18:12
2
$\begingroup$

The haskell monad you mention models the process of drawing from a sequence at random. It is a state monad--with underlying map of objects $X \mapsto (S\times X)^S$--where the state includes the remaining list of elements and a 'source of randomness'. Every object $S$ of a Cartesian closed category induces a state monad on that category.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.