tweag / monad-bayes

A library for probabilistic programming in Haskell.
MIT License
407 stars 62 forks source link

`compact` function sorts by probability #353

Open gaurav-arya opened 2 months ago

gaurav-arya commented 2 months ago

The docstring of compact states that result will be "sorted ascendingly according to values", but it seems like there is a sortOn (Down . snd) in the code that causes the result to actually be sorted in descending order of probability.

https://github.com/tweag/monad-bayes/blob/14faeb72ba7a043e28e8f350813b50d3397caa1b/src/Control/Monad/Bayes/Enumerator.hs#L94

reubenharry commented 2 months ago

Yep, good catch! Feel free to submit a PR for the docstring