From 93908693049eb37f3e2a172218b1de92834051a4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 21 Dec 2017 11:14:31 -0500 Subject: [PATCH] :memo: the MonadNonDet instance for NonDetEff. --- src/Control/Monad/Effect/NonDet.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Control/Monad/Effect/NonDet.hs b/src/Control/Monad/Effect/NonDet.hs index fe41d30e1..f6d522613 100644 --- a/src/Control/Monad/Effect/NonDet.hs +++ b/src/Control/Monad/Effect/NonDet.hs @@ -16,6 +16,7 @@ class (Alternative m, Monad m) => MonadNonDet m where -> m a -- ^ The computation to run locally-nondeterministically. -> m b -- ^ A _deterministic_ computation producing the 'Monoid'al accumulation of the _locally-nondeterministic_ result values. +-- | Effect stacks containing 'NonDetEff' offer a 'MonadNonDet' instance which implements 'collect' by interpreting the requests for nondeterminism locally, without removing 'NonDetEff' from the stackā€”i.e. the _capacity_ for nondeterminism is still present in the effect stack, but any local nondeterminism has been applied. instance (NonDetEff :< fs) => MonadNonDet (Eff fs) where collect f = interpose (pure . f) (\ m k -> case m of MZero -> pure mempty