Open turion opened 1 year ago
That is fair to say, and I don't oppose that.
I tried to use the state version instead of the free version but get an unsatisfied constraint. If here:
https://github.com/tweag/monad-bayes/blob/free-vs-state/src/Control/Monad/Bayes/Traced/Basic.hs#L26
you import import Control.Monad.Bayes.Density.State (Density)
then I get
src/Control/Monad/Bayes/Traced/Basic.hs:60:19: error:
• Could not deduce (MonadDistribution Identity)
arising from a use of ‘random’
from the context: MonadDistribution m
bound by the instance declaration
at src/Control/Monad/Bayes/Traced/Basic.hs:59:10-60
• In the first argument of ‘Traced’, namely ‘random’
In the expression: Traced random (fmap singleton random)
In an equation for ‘random’:
random = Traced random (fmap singleton random)
|
60 | random = Traced random (fmap singleton random)
Can anyone explain what is happening? I presume at some point the state version worked.
Hmm, actually not entirely sure it ever worked. This is perhaps irrelevant since it looks like we'll remove this. The error looks familiar though.
In the docs we describe two density monads (https://github.com/tweag/monad-bayes/blob/master/docs/docs/usage.md#density):
In the code we have both variants, but only the free density monad (supposedly faster) is used outside this part:
https://github.com/tweag/monad-bayes/blob/31579b3e454ea19f7b5b5f12f34486e754066d31/src/Control/Monad/Bayes/Traced/Common.hs#L84
@reubenharry @idontgetoutmuch Is it fair to say that realistically, we will only ever use the free density monad, and the state density monad is only for didactic purposes? If so, I'd vote for removing the corresponding code and simplifying the leftovers, and keep the state density only in the docs, which would be slightly adapted.