Repository navigation
mapMaybeM #183
Copy link
Copy link
Closed
Milestone
Description
Activity
- Have you seen the witherable package?…On Tue, Aug 29, 2017 at 10:13 AM Andrew Martin ***@***.***> wrote: 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 <https://hackage.haskell.org/package/monad-extras-0.6.0/docs/Control-Monad-Extra.html#v:mapMaybeM>, extra <https://hackage.haskell.org/package/extra-1.6/docs/Control-Monad-Extra.html#v:mapMaybeM>, and in stack <https://hackage.haskell.org/package/stack-1.0.0/docs/src/Data.Maybe.Extra.html>. 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. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#183>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAAQwsq4PplMJdQOTB0QpMvTg2edcbgfks5sdBx7gaJpZM4PGAYH> .
I have. Still, a more direct definition of
mapMaybeMwould be more efficient that usingwitherM.- 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> .
- 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.…Sent from my iPhoneOn 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.
Also witherable instance couldn't be defined for both unboxed and storable vectors
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?
- 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?…On Wed, Apr 4, 2018 at 5:46 PM Andrew Martin ***@***.***> wrote: 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? — 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/AAAQwkvnM-Gxaqc6vA5j4Fhc7HDSBCxgks5tlT9NgaJpZM4PGAYH> .
What do you mean by a witherable-style interface? Currently,
witheris 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 aMonadconstraint. So, I don't think that the witherable interface can be supported.- added a commit that references this issue
on Nov 5, 2018 - added a commit that references this issue
on Oct 10, 2020 - added a commit that references this issue
on Jan 16, 2021
Metadata
Metadata
Assignees
Labels
No labels
Can I add
mapMaybeMtovector? The type signature would be:Although the list-equivalent of
mapMaybeMis not inbase, it's a pretty common thing for people to write. I can see from some googling that it exists inmonad-extras,extra, and instack. 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.