Proposal: Add IsList instance for ZipList

Michael Snoyman michael at snoyman.com
Thu Jun 11 11:25:28 UTC 2015


I agree with Edward and David, this instance looks like it would be a
useful addition.

On Thu, Jun 11, 2015, 2:22 PM Edward Kmett <ekmett at gmail.com> wrote:

> I personally strongly believe in keeping the Applicative and Monad for a
> type compatible.
>
> Otherwise why the heck did we make Applicative a superclass of Monad?
>
> In this case the thing David wants only makes any difference if you
> explicitly turn on OverloadedLists, so if you never use that extension
> you'll never care about the instance anyways.
>
> -Edward
>
> On Thu, Jun 11, 2015 at 11:26 AM, Henning Thielemann <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Wed, 10 Jun 2015, David Feuer wrote:
>>
>>  foo = getZipList $ [f,g,h] <$> [a,b,c] <*> [d,e,i]
>>>
>>> looks a lot better than
>>>
>>> bar = getZipList $ ZipList [f,g,h] <$> ZipList [a,b,c] <*> ZipList
>>> [d,e,i]
>>>
>>
>> But the second one is less surprising.
>>
>> For my taste it would have been better to give the ZipList semantics to
>> the list type by default, because there are more data types that we can
>> give a ZipList-like Applicative instance. The current non-determinism
>> implementation for Applicative [] and Monad [] could have been used for a
>> special non-determinism list type. But this instance was defined when there
>> was no Applicative. :-(
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>
> _______________________________________________
> 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/20150611/a4665bf9/attachment.html>


More information about the Libraries mailing list