| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Weighted.Class
Documentation
class (Semiring w, Monad m) => MonadWeighted w m | m -> w where Source #
Methods
weighted :: (a, w) -> m a Source #
embeds a simple weighted action.weighted (a,w)
is an action that produces the output weight ww.
weigh :: m a -> m (a, w) Source #
is an action that executes the action weigh mm and adds
its output to the value of the computation.
scale :: m (a, w -> w) -> m a Source #
is an action that executes the action scale mm, which
returns a value and a function, and returns the value, applying
the function to the output.
Instances
| MonadWeighted w m => MonadWeighted w (MaybeT m) Source # | |
| MonadWeighted w m => MonadWeighted w (StateT s m) Source # | |
| MonadWeighted w m => MonadWeighted w (StateT s m) Source # | |
| MonadWeighted w m => MonadWeighted w (IdentityT * m) Source # | |
| MonadWeighted w m => MonadWeighted w (ExceptT e m) Source # | |
| (DetectableZero w, Monad m, Alternative m) => MonadWeighted w (FilterT w m) Source # | |
| (Semiring w, Monad m) => MonadWeighted w (WeightedT w m) Source # | |
| MonadWeighted w m => MonadWeighted w (ReaderT * r m) Source # | |
collect :: (Foldable m, MonadWeighted w m) => m a -> w Source #
toCont :: (Foldable m, MonadWeighted w m) => (a -> w) -> m a -> w Source #