packages feed

monad-bayes 1.3.0.4 → 1.3.0.5

raw patch · 6 files changed

+62/−10 lines, 6 filesdep ~basedep ~brickdep ~vtyPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, brick, vty

API changes (from Hackage documentation)

+ Control.Monad.Bayes.Class: class Monad m => MonadUniformRange (m :: Type -> Type)
+ Control.Monad.Bayes.Class: instance (GHC.Base.Monoid w, Control.Monad.Bayes.Class.MonadUniformRange m) => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.Writer.Lazy.WriterT w m)
+ Control.Monad.Bayes.Class: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.Cont.ContT r m)
+ Control.Monad.Bayes.Class: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.Except.ExceptT e m)
+ Control.Monad.Bayes.Class: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.Identity.IdentityT m)
+ Control.Monad.Bayes.Class: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.Reader.ReaderT r m)
+ Control.Monad.Bayes.Class: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Trans.State.Lazy.StateT s m)
+ Control.Monad.Bayes.Class: uniformR :: (MonadUniformRange m, UniformRange a) => a -> a -> m a
+ Control.Monad.Bayes.Inference.SMC2: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Bayes.Inference.SMC2.SMC2 m)
+ Control.Monad.Bayes.Population: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Bayes.Population.ListT m)
+ Control.Monad.Bayes.Population: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Bayes.Population.PopulationT m)
+ Control.Monad.Bayes.Sampler.Strict: instance Control.Monad.Primitive.PrimMonad m => Control.Monad.Primitive.PrimMonad (Control.Monad.Bayes.Sampler.Strict.SamplerT g m)
+ Control.Monad.Bayes.Sampler.Strict: instance System.Random.Internal.StatefulGen g m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Bayes.Sampler.Strict.SamplerT g m)
+ Control.Monad.Bayes.Weighted: instance Control.Monad.Bayes.Class.MonadUniformRange m => Control.Monad.Bayes.Class.MonadUniformRange (Control.Monad.Bayes.Weighted.WeightedT m)
- Control.Monad.Bayes.Class: Bayesian :: m z -> (z -> m o) -> (z -> o -> Log Double) -> Bayesian m z o
+ Control.Monad.Bayes.Class: Bayesian :: m z -> (z -> m o) -> (z -> o -> Log Double) -> Bayesian (m :: Type -> Type) z o
- Control.Monad.Bayes.Class: [generative] :: Bayesian m z o -> z -> m o
+ Control.Monad.Bayes.Class: [generative] :: Bayesian (m :: Type -> Type) z o -> z -> m o
- Control.Monad.Bayes.Class: [likelihood] :: Bayesian m z o -> z -> o -> Log Double
+ Control.Monad.Bayes.Class: [likelihood] :: Bayesian (m :: Type -> Type) z o -> z -> o -> Log Double
- Control.Monad.Bayes.Class: [prior] :: Bayesian m z o -> m z
+ Control.Monad.Bayes.Class: [prior] :: Bayesian (m :: Type -> Type) z o -> m z
- Control.Monad.Bayes.Class: class (Monad m) => MonadDistribution m
+ Control.Monad.Bayes.Class: class Monad m => MonadDistribution (m :: Type -> Type)
- Control.Monad.Bayes.Class: class (Monad m) => MonadFactor m
+ Control.Monad.Bayes.Class: class Monad m => MonadFactor (m :: Type -> Type)
- Control.Monad.Bayes.Class: class (MonadDistribution m, MonadFactor m) => MonadMeasure m
+ Control.Monad.Bayes.Class: class (MonadDistribution m, MonadFactor m) => MonadMeasure (m :: Type -> Type)
- Control.Monad.Bayes.Class: data Bayesian m z o
+ Control.Monad.Bayes.Class: data Bayesian (m :: Type -> Type) z o
- Control.Monad.Bayes.Class: newtype () => Log a
+ Control.Monad.Bayes.Class: newtype Log a
- Control.Monad.Bayes.Class: type Kernel a b = forall m. (MonadMeasure m) => a -> m b
+ Control.Monad.Bayes.Class: type Kernel a b = forall (m :: Type -> Type). MonadMeasure m => a -> m b
- Control.Monad.Bayes.Class: type Measure a = forall m. (MonadMeasure m) => m a
+ Control.Monad.Bayes.Class: type Measure a = forall (m :: Type -> Type). MonadMeasure m => m a
- Control.Monad.Bayes.Density.Free: DensityT :: FT SamF m a -> DensityT m a
+ Control.Monad.Bayes.Density.Free: DensityT :: FT SamF m a -> DensityT (m :: Type -> Type) a
- Control.Monad.Bayes.Density.Free: [getDensityT] :: DensityT m a -> FT SamF m a
+ Control.Monad.Bayes.Density.Free: [getDensityT] :: DensityT (m :: Type -> Type) a -> FT SamF m a
- Control.Monad.Bayes.Density.Free: hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> DensityT m a -> DensityT n a
+ Control.Monad.Bayes.Density.Free: hoist :: (Monad m, Monad n) => (forall x. () => m x -> n x) -> DensityT m a -> DensityT n a
- Control.Monad.Bayes.Density.Free: newtype DensityT m a
+ Control.Monad.Bayes.Density.Free: newtype DensityT (m :: Type -> Type) a
- Control.Monad.Bayes.Density.State: DensityT :: WriterT [Double] (StateT [Double] m) a -> DensityT m a
+ Control.Monad.Bayes.Density.State: DensityT :: WriterT [Double] (StateT [Double] m) a -> DensityT (m :: Type -> Type) a
- Control.Monad.Bayes.Density.State: [getDensityT] :: DensityT m a -> WriterT [Double] (StateT [Double] m) a
+ Control.Monad.Bayes.Density.State: [getDensityT] :: DensityT (m :: Type -> Type) a -> WriterT [Double] (StateT [Double] m) a
- Control.Monad.Bayes.Density.State: newtype DensityT m a
+ Control.Monad.Bayes.Density.State: newtype DensityT (m :: Type -> Type) a
- Control.Monad.Bayes.Inference.Lazy.MH: mh :: forall a. Double -> WeightedT Sampler a -> IO [(a, Log Double)]
+ Control.Monad.Bayes.Inference.Lazy.MH: mh :: Double -> WeightedT Sampler a -> IO [(a, Log Double)]
- Control.Monad.Bayes.Inference.Lazy.MH: mutateTree :: forall g. RandomGen g => Double -> g -> Tree -> Tree
+ Control.Monad.Bayes.Inference.Lazy.MH: mutateTree :: RandomGen g => Double -> g -> Tree -> Tree
- Control.Monad.Bayes.Inference.MCMC: independentSamples :: Monad m => TracedT m a -> Producer (MHResult a) m (Trace a)
+ Control.Monad.Bayes.Inference.MCMC: independentSamples :: forall (m :: Type -> Type) a. Monad m => TracedT m a -> Producer (MHResult a) m (Trace a)
- Control.Monad.Bayes.Inference.MCMC: mcmcP :: MonadDistribution m => MCMCConfig -> TracedT m a -> Producer (MHResult a) m ()
+ Control.Monad.Bayes.Inference.MCMC: mcmcP :: forall (m :: Type -> Type) a. MonadDistribution m => MCMCConfig -> TracedT m a -> Producer (MHResult a) m ()
- Control.Monad.Bayes.Inference.PMMH: pmmhBayesianModel :: MonadMeasure m => MCMCConfig -> SMCConfig (WeightedT m) -> (forall m'. MonadMeasure m' => Bayesian m' a1 a2) -> m [[(a2, Log Double)]]
+ Control.Monad.Bayes.Inference.PMMH: pmmhBayesianModel :: MonadMeasure m => MCMCConfig -> SMCConfig (WeightedT m) -> (forall (m' :: Type -> Type). MonadMeasure m' => Bayesian m' a1 a2) -> m [[(a2, Log Double)]]
- Control.Monad.Bayes.Inference.RMSMC: rmsmc :: MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
+ Control.Monad.Bayes.Inference.RMSMC: rmsmc :: forall (m :: Type -> Type) a. MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
- Control.Monad.Bayes.Inference.RMSMC: rmsmcBasic :: MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
+ Control.Monad.Bayes.Inference.RMSMC: rmsmcBasic :: forall (m :: Type -> Type) a. MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
- Control.Monad.Bayes.Inference.RMSMC: rmsmcDynamic :: MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
+ Control.Monad.Bayes.Inference.RMSMC: rmsmcDynamic :: forall (m :: Type -> Type) a. MonadDistribution m => MCMCConfig -> SMCConfig m -> SequentialT (TracedT (PopulationT m)) a -> PopulationT m a
- Control.Monad.Bayes.Inference.SMC: SMCConfig :: (forall x. PopulationT m x -> PopulationT m x) -> Int -> Int -> SMCConfig m
+ Control.Monad.Bayes.Inference.SMC: SMCConfig :: (forall x. () => PopulationT m x -> PopulationT m x) -> Int -> Int -> SMCConfig (m :: Type -> Type)
- Control.Monad.Bayes.Inference.SMC: [numParticles] :: SMCConfig m -> Int
+ Control.Monad.Bayes.Inference.SMC: [numParticles] :: SMCConfig (m :: Type -> Type) -> Int
- Control.Monad.Bayes.Inference.SMC: [numSteps] :: SMCConfig m -> Int
+ Control.Monad.Bayes.Inference.SMC: [numSteps] :: SMCConfig (m :: Type -> Type) -> Int
- Control.Monad.Bayes.Inference.SMC: [resampler] :: SMCConfig m -> forall x. PopulationT m x -> PopulationT m x
+ Control.Monad.Bayes.Inference.SMC: [resampler] :: SMCConfig (m :: Type -> Type) -> forall x. () => PopulationT m x -> PopulationT m x
- Control.Monad.Bayes.Inference.SMC: data SMCConfig m
+ Control.Monad.Bayes.Inference.SMC: data SMCConfig (m :: Type -> Type)
- Control.Monad.Bayes.Inference.SMC: smc :: MonadDistribution m => SMCConfig m -> SequentialT (PopulationT m) a -> PopulationT m a
+ Control.Monad.Bayes.Inference.SMC: smc :: forall (m :: Type -> Type) a. MonadDistribution m => SMCConfig m -> SequentialT (PopulationT m) a -> PopulationT m a
- Control.Monad.Bayes.Inference.SMC: smcPush :: MonadMeasure m => SMCConfig m -> SequentialT (PopulationT m) a -> PopulationT m a
+ Control.Monad.Bayes.Inference.SMC: smcPush :: forall (m :: Type -> Type) a. MonadMeasure m => SMCConfig m -> SequentialT (PopulationT m) a -> PopulationT m a
- Control.Monad.Bayes.Inference.SMC2: data SMC2 m a
+ Control.Monad.Bayes.Inference.SMC2: data SMC2 (m :: Type -> Type) a
- Control.Monad.Bayes.Inference.SMC2: smc2 :: MonadDistribution m => Int -> Int -> Int -> Int -> SequentialT (TracedT (PopulationT m)) b -> (b -> SequentialT (PopulationT (SMC2 m)) a) -> PopulationT m [(a, Log Double)]
+ Control.Monad.Bayes.Inference.SMC2: smc2 :: forall (m :: Type -> Type) b a. MonadDistribution m => Int -> Int -> Int -> Int -> SequentialT (TracedT (PopulationT m)) b -> (b -> SequentialT (PopulationT (SMC2 m)) a) -> PopulationT m [(a, Log Double)]
- Control.Monad.Bayes.Population: PopulationT :: WeightedT (ListT m) a -> PopulationT m a
+ Control.Monad.Bayes.Population: PopulationT :: WeightedT (ListT m) a -> PopulationT (m :: Type -> Type) a
- Control.Monad.Bayes.Population: [getPopulationT] :: PopulationT m a -> WeightedT (ListT m) a
+ Control.Monad.Bayes.Population: [getPopulationT] :: PopulationT (m :: Type -> Type) a -> WeightedT (ListT m) a
- Control.Monad.Bayes.Population: extractEvidence :: Monad m => PopulationT m a -> PopulationT (WeightedT m) a
+ Control.Monad.Bayes.Population: extractEvidence :: forall (m :: Type -> Type) a. Monad m => PopulationT m a -> PopulationT (WeightedT m) a
- Control.Monad.Bayes.Population: hoist :: Monad n => (forall x. m x -> n x) -> PopulationT m a -> PopulationT n a
+ Control.Monad.Bayes.Population: hoist :: Monad n => (forall x. () => m x -> n x) -> PopulationT m a -> PopulationT n a
- Control.Monad.Bayes.Population: newtype PopulationT m a
+ Control.Monad.Bayes.Population: newtype PopulationT (m :: Type -> Type) a
- Control.Monad.Bayes.Population: proper :: MonadDistribution m => PopulationT m a -> WeightedT m a
+ Control.Monad.Bayes.Population: proper :: forall (m :: Type -> Type) a. MonadDistribution m => PopulationT m a -> WeightedT m a
- Control.Monad.Bayes.Population: pushEvidence :: MonadFactor m => PopulationT m a -> PopulationT m a
+ Control.Monad.Bayes.Population: pushEvidence :: forall (m :: Type -> Type) a. MonadFactor m => PopulationT m a -> PopulationT m a
- Control.Monad.Bayes.Population: resampleMultinomial :: MonadDistribution m => PopulationT m a -> PopulationT m a
+ Control.Monad.Bayes.Population: resampleMultinomial :: forall (m :: Type -> Type) a. MonadDistribution m => PopulationT m a -> PopulationT m a
- Control.Monad.Bayes.Population: resampleStratified :: MonadDistribution m => PopulationT m a -> PopulationT m a
+ Control.Monad.Bayes.Population: resampleStratified :: forall (m :: Type -> Type) a. MonadDistribution m => PopulationT m a -> PopulationT m a
- Control.Monad.Bayes.Population: resampleSystematic :: MonadDistribution m => PopulationT m a -> PopulationT m a
+ Control.Monad.Bayes.Population: resampleSystematic :: forall (m :: Type -> Type) a. MonadDistribution m => PopulationT m a -> PopulationT m a
- Control.Monad.Bayes.Population: spawn :: Monad m => Int -> PopulationT m ()
+ Control.Monad.Bayes.Population: spawn :: forall (m :: Type -> Type). Monad m => Int -> PopulationT m ()
- Control.Monad.Bayes.Population: withParticles :: Monad m => Int -> PopulationT m a -> PopulationT m a
+ Control.Monad.Bayes.Population: withParticles :: forall (m :: Type -> Type) a. Monad m => Int -> PopulationT m a -> PopulationT m a
- Control.Monad.Bayes.Sampler.Lazy: SamplerT :: (Tree -> m a) -> SamplerT m a
+ Control.Monad.Bayes.Sampler.Lazy: SamplerT :: (Tree -> m a) -> SamplerT (m :: Type -> Type) a
- Control.Monad.Bayes.Sampler.Lazy: [runSamplerT] :: SamplerT m a -> Tree -> m a
+ Control.Monad.Bayes.Sampler.Lazy: [runSamplerT] :: SamplerT (m :: Type -> Type) a -> Tree -> m a
- Control.Monad.Bayes.Sampler.Lazy: newtype SamplerT m a
+ Control.Monad.Bayes.Sampler.Lazy: newtype SamplerT (m :: Type -> Type) a
- Control.Monad.Bayes.Sampler.Strict: SamplerT :: ReaderT g m a -> SamplerT g m a
+ Control.Monad.Bayes.Sampler.Strict: SamplerT :: ReaderT g m a -> SamplerT g (m :: Type -> Type) a
- Control.Monad.Bayes.Sampler.Strict: [runSamplerT] :: SamplerT g m a -> ReaderT g m a
+ Control.Monad.Bayes.Sampler.Strict: [runSamplerT] :: SamplerT g (m :: Type -> Type) a -> ReaderT g m a
- Control.Monad.Bayes.Sampler.Strict: newtype SamplerT g m a
+ Control.Monad.Bayes.Sampler.Strict: newtype SamplerT g (m :: Type -> Type) a
- Control.Monad.Bayes.Sampler.Strict: type SamplerIO = SamplerT (IOGenM StdGen) IO
+ Control.Monad.Bayes.Sampler.Strict: type SamplerIO = SamplerT IOGenM StdGen IO
- Control.Monad.Bayes.Sampler.Strict: type SamplerST s = SamplerT (STGenM StdGen s) (ST s)
+ Control.Monad.Bayes.Sampler.Strict: type SamplerST s = SamplerT STGenM StdGen s ST s
- Control.Monad.Bayes.Sequential.Coroutine: advance :: Monad m => SequentialT m a -> SequentialT m a
+ Control.Monad.Bayes.Sequential.Coroutine: advance :: forall (m :: Type -> Type) a. Monad m => SequentialT m a -> SequentialT m a
- Control.Monad.Bayes.Sequential.Coroutine: data SequentialT m a
+ Control.Monad.Bayes.Sequential.Coroutine: data SequentialT (m :: Type -> Type) a
- Control.Monad.Bayes.Sequential.Coroutine: hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> SequentialT m a -> SequentialT n a
+ Control.Monad.Bayes.Sequential.Coroutine: hoist :: (Monad m, Monad n) => (forall x. () => m x -> n x) -> SequentialT m a -> SequentialT n a
- Control.Monad.Bayes.Sequential.Coroutine: hoistFirst :: (forall x. m x -> m x) -> SequentialT m a -> SequentialT m a
+ Control.Monad.Bayes.Sequential.Coroutine: hoistFirst :: (forall x. () => m x -> m x) -> SequentialT m a -> SequentialT m a
- Control.Monad.Bayes.Sequential.Coroutine: sequentially :: Monad m => (forall x. m x -> m x) -> Int -> SequentialT m a -> m a
+ Control.Monad.Bayes.Sequential.Coroutine: sequentially :: Monad m => (forall x. () => m x -> m x) -> Int -> SequentialT m a -> m a
- Control.Monad.Bayes.Sequential.Coroutine: sis :: Monad m => (forall x. m x -> m x) -> Int -> SequentialT m a -> m a
+ Control.Monad.Bayes.Sequential.Coroutine: sis :: Monad m => (forall x. () => m x -> m x) -> Int -> SequentialT m a -> m a
- Control.Monad.Bayes.Sequential.Coroutine: suspend :: Monad m => SequentialT m ()
+ Control.Monad.Bayes.Sequential.Coroutine: suspend :: forall (m :: Type -> Type). Monad m => SequentialT m ()
- Control.Monad.Bayes.Traced.Basic: data TracedT m a
+ Control.Monad.Bayes.Traced.Basic: data TracedT (m :: Type -> Type) a
- Control.Monad.Bayes.Traced.Basic: hoist :: (forall x. m x -> m x) -> TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Basic: hoist :: (forall x. () => m x -> m x) -> TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Basic: mhStep :: MonadDistribution m => TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Basic: mhStep :: forall (m :: Type -> Type) a. MonadDistribution m => TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Dynamic: data TracedT m a
+ Control.Monad.Bayes.Traced.Dynamic: data TracedT (m :: Type -> Type) a
- Control.Monad.Bayes.Traced.Dynamic: freeze :: Monad m => TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Dynamic: freeze :: forall (m :: Type -> Type) a. Monad m => TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Dynamic: hoist :: (forall x. m x -> m x) -> TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Dynamic: hoist :: (forall x. () => m x -> m x) -> TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Dynamic: mhStep :: MonadDistribution m => TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Dynamic: mhStep :: forall (m :: Type -> Type) a. MonadDistribution m => TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Static: TracedT :: WeightedT (DensityT m) a -> m (Trace a) -> TracedT m a
+ Control.Monad.Bayes.Traced.Static: TracedT :: WeightedT (DensityT m) a -> m (Trace a) -> TracedT (m :: Type -> Type) a
- Control.Monad.Bayes.Traced.Static: [model] :: TracedT m a -> WeightedT (DensityT m) a
+ Control.Monad.Bayes.Traced.Static: [model] :: TracedT (m :: Type -> Type) a -> WeightedT (DensityT m) a
- Control.Monad.Bayes.Traced.Static: [traceDist] :: TracedT m a -> m (Trace a)
+ Control.Monad.Bayes.Traced.Static: [traceDist] :: TracedT (m :: Type -> Type) a -> m (Trace a)
- Control.Monad.Bayes.Traced.Static: data TracedT m a
+ Control.Monad.Bayes.Traced.Static: data TracedT (m :: Type -> Type) a
- Control.Monad.Bayes.Traced.Static: hoist :: (forall x. m x -> m x) -> TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Static: hoist :: (forall x. () => m x -> m x) -> TracedT m a -> TracedT m a
- Control.Monad.Bayes.Traced.Static: mhStep :: MonadDistribution m => TracedT m a -> TracedT m a
+ Control.Monad.Bayes.Traced.Static: mhStep :: forall (m :: Type -> Type) a. MonadDistribution m => TracedT m a -> TracedT m a
- Control.Monad.Bayes.Weighted: data WeightedT m a
+ Control.Monad.Bayes.Weighted: data WeightedT (m :: Type -> Type) a
- Control.Monad.Bayes.Weighted: hoist :: (forall x. m x -> n x) -> WeightedT m a -> WeightedT n a
+ Control.Monad.Bayes.Weighted: hoist :: (forall x. () => m x -> n x) -> WeightedT m a -> WeightedT n a
- Math.Integrators.StormerVerlet: type Integrator a = -- | Step Double -> -- | Initial value a -> -- | Next value a
+ Math.Integrators.StormerVerlet: type Integrator a = Double -> a -> a

Files

monad-bayes.cabal view
@@ -1,15 +1,13 @@ cabal-version:   2.2 name:            monad-bayes-version:         1.3.0.4+version:         1.3.0.5 license:         MIT license-file:    LICENSE.md copyright:       2015-2020 Adam Scibior maintainer:      dominic.steinitz@tweag.io author:          Adam Scibior <adscib@gmail.com> stability:       experimental-tested-with:-  GHC ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.4 || ==9.8.2 || ==9.10.1-+tested-with:     GHC ==9.0 || ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 homepage:        http://github.com/tweag/monad-bayes#readme bug-reports:     https://github.com/tweag/monad-bayes/issues synopsis:        A library for probabilistic programming.@@ -40,8 +38,8 @@  common deps   build-depends:-    , base             >=4.15     && <4.21-    , brick            >=2.3.1    && <2.6+    , base             >=4.15     && <4.22+    , brick            ^>=2.10     , containers       >=0.6      && <0.8     , foldl            ^>=1.4     , free             ^>=5.2@@ -67,7 +65,7 @@     , text             >=1.2      && <2.2     , transformers     >=0.5.6    && <0.7     , vector           >=0.12.0   && <0.14-    , vty              >=6.1      && <6.3+    , vty              >=6.4      && <6.6     , vty-unix         ^>=0.2.0.0  common test-deps
src/Control/Monad/Bayes/Class.hs view
@@ -71,6 +71,8 @@     Measure,     Kernel,     Log (ln, Exp),+    MonadUniformRange,+    uniformR,   ) where @@ -105,6 +107,7 @@ import Statistics.Distribution.Normal (normalDistr) import Statistics.Distribution.Poisson qualified as Poisson import Statistics.Distribution.Uniform (uniformDistr)+import System.Random (UniformRange)  -- | Monads that can draw random variables. class (Monad m) => MonadDistribution m where@@ -114,6 +117,8 @@     m Double    -- | Draw from a uniform distribution.+  --+  -- See also 'MonadUniformRange.uniformR' for types other than 'Double'.   uniform ::     -- | lower bound a     Double ->@@ -339,6 +344,19 @@ histogramToList :: Histogram -> [(Double, Double)] histogramToList = H.asList +-- | Monads that can efficiently draw uniform variables of+-- 'UniformRange' types.+class (Monad m) => MonadUniformRange m where+  -- | Draw from a uniform distribution for some 'UniformRange' type.+  uniformR ::+    (UniformRange a) =>+    -- | lower bound l (inclusive for discrete types)+    a ->+    -- | upper bound u (inclusive for discrete types)+    a ->+    -- | \(\sim \mathcal{U}(l, u)\).+    m a+ ---------------------------------------------------------------------------- -- Instances that lift probabilistic effects to standard tranformers. @@ -351,6 +369,9 @@  instance (MonadMeasure m) => MonadMeasure (IdentityT m) +instance (MonadUniformRange m) => MonadUniformRange (IdentityT m) where+  uniformR l u = lift $ uniformR l u+ instance (MonadDistribution m) => MonadDistribution (ExceptT e m) where   random = lift random   uniformD = lift . uniformD@@ -364,11 +385,17 @@   random = lift random   bernoulli = lift . bernoulli +instance (MonadUniformRange m) => MonadUniformRange (ExceptT e m) where+  uniformR l u = lift $ uniformR l u+ instance (MonadFactor m) => MonadFactor (ReaderT r m) where   score = lift . score  instance (MonadMeasure m) => MonadMeasure (ReaderT r m) +instance (MonadUniformRange m) => MonadUniformRange (ReaderT r m) where+  uniformR l u = lift $ uniformR l u+ instance (Monoid w, MonadDistribution m) => MonadDistribution (WriterT w m) where   random = lift random   bernoulli = lift . bernoulli@@ -379,6 +406,9 @@  instance (Monoid w, MonadMeasure m) => MonadMeasure (WriterT w m) +instance (Monoid w, MonadUniformRange m) => MonadUniformRange (WriterT w m) where+  uniformR l u = lift $ uniformR l u+ instance (MonadDistribution m) => MonadDistribution (StateT s m) where   random = lift random   bernoulli = lift . bernoulli@@ -390,6 +420,9 @@  instance (MonadMeasure m) => MonadMeasure (StateT s m) +instance (MonadUniformRange m) => MonadUniformRange (StateT s m) where+  uniformR l u = lift $ uniformR l u+ instance (MonadDistribution m) => MonadDistribution (ContT r m) where   random = lift random @@ -397,3 +430,6 @@   score = lift . score  instance (MonadMeasure m) => MonadMeasure (ContT r m)++instance (MonadUniformRange m) => MonadUniformRange (ContT r m) where+  uniformR l u = lift $ uniformR l u
src/Control/Monad/Bayes/Inference/SMC2.hs view
@@ -23,6 +23,7 @@   ( MonadDistribution (random),     MonadFactor (..),     MonadMeasure,+    MonadUniformRange (uniformR),   ) import Control.Monad.Bayes.Inference.MCMC import Control.Monad.Bayes.Inference.RMSMC (rmsmc)@@ -45,6 +46,9 @@  instance (MonadDistribution m) => MonadDistribution (SMC2 m) where   random = lift random++instance (MonadUniformRange m) => MonadUniformRange (SMC2 m) where+  uniformR l u = lift $ uniformR l u  instance (Monad m) => MonadFactor (SMC2 m) where   score = SMC2 . score
src/Control/Monad/Bayes/Population.hs view
@@ -45,6 +45,7 @@   ( MonadDistribution (..),     MonadFactor (..),     MonadMeasure,+    MonadUniformRange (..),     factor,   ) import Control.Monad.Bayes.Weighted@@ -95,6 +96,9 @@   bernoulli = lift . bernoulli   categorical = lift . categorical +instance (MonadUniformRange m) => MonadUniformRange (ListT m) where+  uniformR l u = lift $ uniformR l u+ instance (MonadFactor m) => MonadFactor (ListT m) where   score = lift . score @@ -102,7 +106,7 @@  -- | A collection of weighted samples, or particles. newtype PopulationT m a = PopulationT {getPopulationT :: WeightedT (ListT m) a}-  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadDistribution, MonadFactor, MonadMeasure)+  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadDistribution, MonadFactor, MonadMeasure, MonadUniformRange)  instance MonadTrans PopulationT where   lift = PopulationT . lift . lift
src/Control/Monad/Bayes/Sampler/Strict.hs view
@@ -2,6 +2,8 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ImportQualifiedPost #-}+{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE UndecidableInstances #-}  -- | -- Module      : Control.Monad.Bayes.Sampler@@ -39,7 +41,11 @@         random,         uniform       ),+    MonadUniformRange+      ( uniformR+      ),   )+import Control.Monad.Primitive (PrimMonad) import Control.Monad.Reader (MonadIO, ReaderT (..)) import Control.Monad.ST (ST) import Control.Monad.Trans (MonadTrans)@@ -49,7 +55,7 @@  -- | The sampling interpretation of a probabilistic program -- Here m is typically IO or ST-newtype SamplerT g m a = SamplerT {runSamplerT :: ReaderT g m a} deriving (Functor, Applicative, Monad, MonadIO, MonadTrans)+newtype SamplerT g m a = SamplerT {runSamplerT :: ReaderT g m a} deriving (Functor, Applicative, Monad, MonadIO, MonadTrans, PrimMonad)  -- | convenient type synonym to show specializations of SamplerT -- to particular pairs of monad and RNG@@ -70,6 +76,9 @@   bernoulli p = SamplerT (ReaderT $ MWC.bernoulli p)   categorical ps = SamplerT (ReaderT $ MWC.categorical ps)   geometric p = SamplerT (ReaderT $ MWC.geometric0 p)++instance (StatefulGen g m) => MonadUniformRange (SamplerT g m) where+  uniformR l u = SamplerT (ReaderT $ uniformRM (l, u))  -- | Sample with a random number generator of your choice e.g. the one -- from `System.Random`.
src/Control/Monad/Bayes/Weighted.hs view
@@ -28,6 +28,7 @@   ( MonadDistribution,     MonadFactor (..),     MonadMeasure,+    MonadUniformRange,     factor,   ) import Control.Monad.State (MonadIO, MonadTrans, StateT (..), lift, mapStateT, modify)@@ -36,7 +37,7 @@ -- | Execute the program using the prior distribution, while accumulating likelihood. newtype WeightedT m a = WeightedT (StateT (Log Double) m a)   -- StateT is more efficient than WriterT-  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadTrans, MonadDistribution)+  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadTrans, MonadDistribution, MonadUniformRange)  instance (Monad m) => MonadFactor (WeightedT m) where   score w = WeightedT (modify (* w))