Deprecate Foldable for Either

Tony Morris tmorris at tmorris.net
Sun Mar 19 22:19:33 UTC 2017


That you can't should be a hint that length for ((,) a) is very definitely
1.

Simply, use a different function, not length, which is well-defined for
((,) a) and other instances.

On Mon, Mar 20, 2017 at 3:15 AM, <amindfv at gmail.com> wrote:

> Is there a clear way to implement this instance warning? I.e. given:
>
> f x = 2 * length x
>
> Can we guarantee at compile time that "f" will never be passed a 2-tuple?
>
> Tom
>
> El 18 mar 2017, a las 20:04, Adam Bergmark <adam at bergmark.nl> escribió:
>
> I'm on the fence about the instance existing. I'm +1 for a warning, and
> thus would be +1 on keeping the instance. +1 on making the warning opt-in
> and +1 keeping it out of -Wall.
>
>
>
> On Sun, 19 Mar 2017 at 00:51 <amindfv at gmail.com> wrote:
>
>>
>>
>> > El 18 mar 2017, a las 16:01, Lana Black <lanablack at amok.cc> escribió:
>> >
>> >> On 18/03/17 19:49, Henning Thielemann wrote:
>> >>
>> >>> On Sat, 18 Mar 2017, Carter Schonwald wrote:
>> >>>
>> >>> for what?
>> >>
>> >> A warning if someone e.g. calls 'length (a,b)', or more generally, if
>> >> certain instances are used.
>> >> _______________________________________________
>> >> Libraries mailing list
>> >> Libraries at haskell.org
>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>> >
>> > Please no. Many of us like our code Wall-clean while still being able to
>> > write polymorphic functions. Adding more warnings that are often
>> > triggered by correct code (redundant constraints, anyone?) only leads to
>> > more headache.
>> >
>> > You could make that an hlint rule on the other hand.
>>
>> Can it be a hlint rule? It seems quite difficult to predict that "length"
>> will not ever be passed e.g. a 2-tuple in the general case, within hlint.
>>
>> I would also favor a warning, and happily have -Wall not include it
>> (though I'd prefer inclusion).
>>
>> Tom
>>
>>
>> > _______________________________________________
>> > 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
>>
>
> _______________________________________________
> 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/20170320/995a8fe5/attachment-0001.html>


More information about the Libraries mailing list