Proposal: instance Alternative ZipList

Dan Burton danburton.email at gmail.com
Fri Jul 17 18:45:27 UTC 2015


+1. It obeys laws. It feels zippy. LGTM.

On Friday, July 17, 2015, Edward Kmett <ekmett at gmail.com> wrote:

> Er.. I obviously meant
>
> instance Alternative ZipList where
>    empty = ZipList []
>    ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)
>
> sorry for any confusion.
>
> On Fri, Jul 17, 2015 at 11:37 AM, Edward Kmett <ekmett at gmail.com
> <javascript:_e(%7B%7D,'cvml','ekmett at gmail.com');>> wrote:
>
>> The ZipList data type admits one legal Alternative instance
>>
>> instance Alternative ZipList where
>>    pure = ZipList []
>>    ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)
>>
>> The legality of this instance was first noted in
>> http://people.cs.kuleuven.be/~tom.schrijvers/Research/papers/ppdp2015.pdf
>>
>> I propose adding this instance, which acts like a generalized version of
>> the Alternative for Maybe, choosing with a left bias.
>>
>> Discussion Period: 2 weeks
>>
>> -Edward
>>
>
>

-- 
-- Dan Burton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150717/ac927ff7/attachment.html>


More information about the Libraries mailing list