scientist-0.0.0.0: A Haskell library for carefully refactoring critical paths.
Safe HaskellNone
LanguageHaskell2010

Scientist

Synopsis

Documentation

data Experiment m c a b Source #

newExperiment :: Functor m => Text -> m a -> Experiment m c a b Source #

setExperimentTry :: Functor m => m b -> Experiment m c a b -> Experiment m c a b Source #

A new, candidate code path

If called multiple times, adds multiple candidate paths.

By default, there are no candidate paths and running the experiment will return ResultSkipped.

setExperimentTryNamed :: Functor m => Text -> m b -> Experiment m c a b -> Experiment m c a b Source #

setExperimentEnabled :: m Bool -> Experiment m c a b -> Experiment m c a b Source #

If the candidate paths should be executed

See experimentEnabledPercent for an example.

By default, candidate paths are always run.

setExperimentOnException :: (SomeException -> m ()) -> Experiment m c a b -> Experiment m c a b Source #

How to handle an exception evaluating or publishing

By default, the exception is re-thrown.

setExperimentCompare :: (Control a -> Either SomeException (Candidate b) -> Bool) -> Experiment m c a b -> Experiment m c a b Source #

Decide if a given result is a match.

See experimentCompareEq and experimentCompareBy.

By default, all comparisons fail.

setExperimentIgnore :: (Control a -> Either SomeException (Candidate b) -> Bool) -> Experiment m c a b -> Experiment m c a b Source #

Decide if a given result should be ignored

By default, no results are ignored.

setExperimentRunIf :: Bool -> Experiment m c a b -> Experiment m c a b Source #

Decide if the experiment should run at all

By default, experiments are run.

setExperimentPublish :: (Result c a b -> m ()) -> Experiment m c a b -> Experiment m c a b Source #

How to publish results

By default, results are not published.

getExperimentPublish :: Applicative m => Experiment m c a b -> Result c a b -> m () Source #

experimentCompareEq :: Eq a => Control a -> Either SomeException (Candidate a) -> Bool Source #

Compare non-exception candidates with the control by (==)

Exception candidates fail comparison.

experimentCompareOn :: Eq b => (a -> b) -> Control a -> Either SomeException (Candidate a) -> Bool Source #

Compare by equality on some function

Exception candidates fail comparison.

experimentCompareBy :: (a -> b -> Bool) -> Control a -> Either SomeException (Candidate b) -> Bool Source #

Compare by some function

Exception candidates fail comparison.

experimentEnabledPercent :: MonadIO m => Int -> m Bool Source #

Enable the experiment in the given percentage of runs

experimentRunInternal :: MonadUnliftIO m => Experiment m c a b -> m (Result c a b) Source #

experimentRun but returning the full Result

Used for testing.