Deprecate Foldable for Either

Adam Bergmark adam at bergmark.nl
Sun Mar 19 16:24:05 UTC 2017


This would have to be determined and triggered at the use site of `f' since
`f :: Foldable t => t a -> Int'. As long as you stay generic the user of
your function will decide whether he wants the warning. If you choose to
specialize your function to a 2-tuple you would get the warning.

Adam


On Sun, 19 Mar 2017 at 17:14 <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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170319/8d9ad55e/attachment.html>


More information about the Libraries mailing list