Proposal: add unzips for Data.Sequence

Tikhon Jelvis tikhon at jelv.is
Fri Jan 12 06:47:46 UTC 2018


I did not know about MonadZip and wouldn't have thought to look for it.

On the other hand, unzip and unzipWith are immediately intuitive.

I think they'd be a solid addition.

On Thu, Jan 11, 2018 at 8:54 PM, David Feuer <david.feuer at gmail.com> wrote:

> We don't strictly *need* to add either of these functions. Users can use
> munzip from the MonadZip instance, and we can add a rewrite rule to turn
>
>     munzip (fmap f xs)
>
> into
>
>     Data.Sequence.Internal.unzipWith f xs
>
> On the other hand, MonadZip isn't a terribly well-known class, and
> unzipWith has always struck me as an obvious analogue of zipWith.
>
> On Jan 11, 2018 10:32 PM, "Ivan Lazar Miljenovic" <
> ivan.miljenovic at gmail.com> wrote:
>
>> On 12 January 2018 at 13:28, David Feuer <david.feuer at gmail.com> wrote:
>> > Paolo G. Giarrusso (Blaisorblade) would like to add an unzip function to
>> > Data.Sequence. I agree. I propose adding
>> >
>> >   unzip :: Seq (a,b) -> (Seq a, Seq b)
>> >
>> >   unzipWith :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b)
>> >
>> > Does anyone object?
>>
>> I see no problem with this.  Though I think it's worth pointing out
>> that Data.List doesn't have unzipWith (though unzipWith f = unzip .
>> map f).
>>
>> --
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic at gmail.com
>> http://IvanMiljenovic.wordpress.com
>>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180111/ca843c1c/attachment.html>


More information about the Libraries mailing list