Constraints on definition of `length` should be strengthened

Sven Panne svenpanne at gmail.com
Mon Apr 3 20:48:33 UTC 2017


2017-04-03 22:29 GMT+02:00 Nathan Bouscal <nbouscal at gmail.com>:

> I expect most people probably agree that it'd be nice to have tuples be an
> unbiased cartesian product, but the actual fact of the matter is that
> tuples as they exist in Haskell are biased.
>

Tuples *are* unbiased, the bias is just an artifact of seeing them as a
curried function, where the positions are "eaten" from left to right.
Again, this mathematically correct, but more often than not the main intent
of using a tuple-


> We can't just ignore that and pretend they're unbiased.
>

We *can* ignore that, just use Henning's Decorated for an isomorphic
variant.


> It definitely sucks that the answer people would naively give to "what is
> a tuple in Haskell" is not the correct answer, but we're stuck in that
> situation.
>

See above, we are not stuck: We *can* get back normal people's intuition
and Haskell's semantics back in line by removing the tuple instances and
adding something like Decorated. It is just a matter of priorities: This
will temporarily damage the Haskell ecosystem a bit, but in the long run it
will be the nicer, more explicit, more intuitive way.


> The question is how to make the best of it.
>

If the tuple instances are removed and Decorated is added, things are easy
to fix: The compiler will tell you exactly the places where you were too
lazy to define and use a custom data type, and the fix is mechanical. The
current situation is quite the opposite: People silently get totally
unexpected behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170403/ecfc084d/attachment.html>


More information about the Libraries mailing list