Open turion opened 2 years ago
This sounds like an issue to take up with Sam Staton and his students - this code comes from their work on LazyPPL, and since they're into denotational semantics, this seems like a thing they'd care about. I've previously been in touch with them, so definitely something we could just ask them.
Is the lazy sampler actually a monad? I believe it doesn't satisfy the monad laws:
Even worse, it's not even a functor with
liftM
:This is because depending on how we construct the program, the random number generator gets split or not. But this is not coassociative (there are no nontrivial comonoids in Haskell) and thus the monad laws don't hold.