warn about dangerous instances (Was: Deprecate Foldable for Either)

Henning Thielemann lemming at henning-thielemann.de
Sun Mar 19 16:25:54 UTC 2017


On Sun, 19 Mar 2017, 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?

I gave an idea in the ticket:
    https://ghc.haskell.org/trac/ghc/ticket/11796

Defining f this way would be ok if x is polymorphic. The warning would 
only arise if f is applied to a pair.


More information about the Libraries mailing list