From 6321c3334cb49072997155e45d336b70e10c9fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20B=C3=A4renz?= Date: Tue, 16 May 2023 16:00:28 +0200 Subject: [PATCH] Simplify SMC2 instances --- src/Control/Monad/Bayes/Inference/SMC2.hs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Control/Monad/Bayes/Inference/SMC2.hs b/src/Control/Monad/Bayes/Inference/SMC2.hs index 3b8a3787..c5608dda 100644 --- a/src/Control/Monad/Bayes/Inference/SMC2.hs +++ b/src/Control/Monad/Bayes/Inference/SMC2.hs @@ -20,7 +20,7 @@ module Control.Monad.Bayes.Inference.SMC2 where import Control.Monad.Bayes.Class - ( MonadDistribution (random), + ( MonadDistribution, MonadFactor (..), MonadMeasure, ) @@ -35,7 +35,7 @@ import Numeric.Log (Log) -- | Helper monad transformer for preprocessing the model for 'smc2'. newtype SMC2 m a = SMC2 (Sequential (Traced (Population m)) a) - deriving newtype (Functor, Applicative, Monad) + deriving newtype (Functor, Applicative, Monad, MonadDistribution, MonadFactor) setup :: SMC2 m a -> Sequential (Traced (Population m)) a setup (SMC2 m) = m @@ -43,12 +43,6 @@ setup (SMC2 m) = m instance MonadTrans SMC2 where lift = SMC2 . lift . lift . lift -instance MonadDistribution m => MonadDistribution (SMC2 m) where - random = lift random - -instance Monad m => MonadFactor (SMC2 m) where - score = SMC2 . score - instance MonadDistribution m => MonadMeasure (SMC2 m) -- | Sequential Monte Carlo squared.