[Haskell-cafe] Help with triple stack monad

Daniel Bergey bergey at teallabs.org
Tue Jun 21 17:33:25 UTC 2016


On 2016-06-21 at 02:12, Christopher Howard <ch.howard at zoho.com> wrote:
> However, it seems that I must implement MonadRandom myself, as there is
> no instance for this sort of arrangement already.

Deriving the class also works, at least with GHC-7.10.3:

newtype ReaderStateRandom r s g a = RSR {
  rSR :: ReaderT r (StateT s (Rand g)) a
  } deriving (Functor, Applicative, Monad, MonadReader r, MonadState s,
  MonadRandom)

bergey


More information about the Haskell-Cafe mailing list