weighted-0.3.0.1: Writer monad which uses semiring constraint

Description

This module provides a weighted monad which filters out zero-weighted results from a computation at every opportunity.

Synopsis

# Documentation

data FilterT s m a Source #

A weighted monad which discards results which are zero as it goes.

Instances

pattern FilterT :: forall m s a. (Alternative m, DetectableZero s, Monad m) => m (a, s) -> FilterT s m a Source #

This pattern gives an interface to the FilterT monad which makes it look as if it were defined without the state monad.

runFilterT :: (DetectableZero s, Alternative m, Monad m) => FilterT s m a -> m (a, s) Source #

Run a filtered computation in the underlying monad.

evalFilterT :: (Monad m, Semiring s) => FilterT s m a -> m a Source #

Evaluate a filtered computation in the underlying monad and return its result.

execFilterT :: (Monad m, Semiring s) => FilterT s m a -> m s Source #

Evaluate a filtered computation in the underlying monad and collect its weight.