-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add newtype to lift classes to monad transformers #272
base: master
Are you sure you want to change the base?
Conversation
random = lift random | ||
bernoulli = lift . bernoulli | ||
categorical = lift . categorical | ||
uniformD = lift . uniformD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only note here would be that some of the previous lifting instances appear to have varied slightly. This actually may have been my doing, because I recall that working in a transformed Enumerator didn't lift bernoulli
, so that discrete distributions got calculated via random
and thus failed with enumerate
.
random = lift random | ||
uniform = (lift .) . uniform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, there may have been a reason that many of the instances were limited to mostly just lift random
. This doesn't change the denotational semantics, but may have efficiency implications, so make sure to benchmark, particularly PMMH and RMSMC.
With this PR, it should be possible to derive the
MonadMeasure
class easily for any monad transformer.