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 Applicative and/or Monad superclasses to Distributive? #12
Comments
This is pretty surprising to me, since some datatypes which currently have |
We could likely leave off with just |
(and The problem is that |
But that still feels funny to me, since the documentation in
It isn't? |
I'd like more things to be able to work with just a Haskell-98 distributive constraint. The bind in adjunctions guarantees adherence to the So my goal is to be able to keep as many instances as possible while amping up the power of Distributive to where it can actually be used in a non-linear situation. |
Any bindDistributive :: (Applicative m, Distributive m) => m a -> (a -> m b) -> m b
bindDistributive m f = m <**> distribute f It won't let you define the |
Oh, and all mfixDistributive :: Distributive m => (a -> m a) -> m a
mfixDistributive = fmap fix . distribute |
The current plan is to package a "Dist" newtype that can be used via
Deriving Via to get access to all of these instances for your data type if
you want them, but to not require them as superclasses, to maintain
compatibility with things like Compose.
…On Fri, Oct 5, 2018 at 4:10 AM Zemyla ***@***.***> wrote:
Oh, and all Distributive instances are also MonadFixs:
mfixDistributive :: Distributive m => (a -> m a) -> m a
mfixDistributive = fmap fix . distribute
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASmEbnKg6qVZpI56ct05ghPLSsPtuefks5uhxPegaJpZM4Gvksn>
.
|
They are implied by the theory.
The text was updated successfully, but these errors were encountered: