Open reubenharry opened 2 years ago
Here's the problem I'm having with using MMorph:
In Population.hs
, hoist
has type
hoist ::
Monad n =>
(forall x. m x -> n x) ->
Population m a ->
Population n a
hoist f = fromWeightedList . f . population
But in MFunctor, it has type
hoist ::
Monad m =>
(forall x. m x -> n x) ->
Population m a ->
Population n a
hoist f = fromWeightedList . f . population
That's a sign that hoist
here isn't actually the simplest function it could be. You're using fromWeightedList
which incurs this constraint, but that function does too much. You should instead compose the more straightforward hoist
functions for ListT
and StateT
. The only issue remaining that I can see is that your ListT
is long deprecated and thus not an instance of MFunctor
anymore. That's a separate issue though and could be circumvented by using mapListT
.
That all sounds sensible. We'd just have to make sure that the new semantics of hoist
is right, since it is critical for the inference algorithms (see for instance its use in Inference/PMMH).
hoist
looks like it should subsumed byMMorph
. (I recall problems with this previously but will try again)