You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can I add mapMaybeM to vector? The type signature would be:
mapMaybeM :: (a -> m (Maybe b)) -> Vector a -> m (Vector b)
Although the list-equivalent of mapMaybeM is not in base, it's a pretty common thing for people to write. I can see from some googling that it exists in monad-extras, extra, and in stack. I bring this up because I think it highlights the utility of such a function and the common expected semantics people seem to have for it.
Sorry, I corrected my comment on github. I meant to say that we could define a mapMaybeM in vector that is more efficient than witherM specialized to Vector and Maybe.
On Aug 29, 2017, at 11:12 PM, Carter Tazio Schonwald ***@***.***> wrote:
Sorry... what do you mean by more definition ?
On Tue, Aug 29, 2017 at 7:24 PM Andrew Martin ***@***.***>
wrote:
> I have. Still, the more definition of mapMaybeM would be more efficient
> that using witherM.
>
> —
> You are receiving this because you commented.
>
>
> Reply to this email directly, view it on GitHub
> <#183 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AAAQwlQT105_I9lhnIWKte0lVisQYpOwks5sdJ3GgaJpZM4PGAYH>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Sure.
I’m hapoy to help with making sure we have a. Decent stream fusion rep if
needed.
One question is if a witherable style interface can be supported too?
What do you mean by a witherable-style interface? Currently, wither is defined as:
wither :: Applicative f => (a -> f (Maybe b)) -> t a -> f (t b)
What I'm proposing is:
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> Vector a -> m (Vector b)
My constraint is stronger, but my understanding is that vector's stream fusion only works with a Monad constraint. So, I don't think that the witherable interface can be supported.
Activity
cartazio commentedon Aug 29, 2017
andrewthad commentedon Aug 29, 2017
I have. Still, a more direct definition of
mapMaybeMwould be more efficient that usingwitherM.cartazio commentedon Aug 30, 2017
andrewthad commentedon Aug 30, 2017
Shimuuar commentedon Oct 14, 2017
Also witherable instance couldn't be defined for both unboxed and storable vectors
andrewthad commentedon Apr 4, 2018
I just noticed the absence of these functions again when I was working on something. Is it alright for me to add these to vector?
cartazio commentedon Apr 5, 2018
andrewthad commentedon Apr 5, 2018
What do you mean by a witherable-style interface? Currently,
witheris defined as:What I'm proposing is:
My constraint is stronger, but my understanding is that
vector's stream fusion only works with aMonadconstraint. So, I don't think that the witherable interface can be supported.Add mapMaybeM and imapMaybeM
Add mapMaybeM and imapMaybeM
Add mapMaybeM and imapMaybeM