Closed reubenharry closed 2 years ago
I the library there is already a more informative type signatures for some of the use cases (see HERE):
type Distribution a = forall m. MonadSample m => m a
type Measure a = forall m. MonadInfer m => m a
type Kernel a b = forall m. MonadInfer m => a -> m b
Do you find adding Monad
prefix more Haskelly? Another option to go with the Haskell style is adding a suffix M
indicating we are in a monadic context.
Then we would have DistributionM
, MeasureM
, etc.
That's true - I added Distribution
etc in Class.hs, but they're a bit restrictive because you can't write e.g. a -> Distribution b
for a conditional distribution, and instead have to use Kernel
.
I think for typeclasses, the convention is MonadX
, as in MonadReader
, MonadState
, etc, but for functions, it's xM
.
You are right @reubenharry! I found a summary on Kowainik blog. As for adding Monad
prefix for typeclasses it is used when a typeclass has mtl style effects, so all is good.
I'm not a huge fan of the names
MonadSample
andMonadInfer
. On the one hand, it's nice to keep aligned with the original paper. But on the other, they're a little misleading.MonadSample
isn't inherently about sampling.I'd proposed the names
MonadDistribution
andMonadMeasure
respectively.The downsides of these are:
Finally I'd replace
MonadCond
withMonadFactor
.