
Hi, Francesco Ariis wrote:
I am not trying to be polemic, just to see where the community stands:
Well, personally, I would not miss neither Foldable nor Traversable instances of (Either b) or ((,) b) for even a fraction of a second. And I know many people who fully agrees. Henning summed it up very well, I think: https://mail.haskell.org/pipermail/libraries/2016-February/026678.html I am completely and utterly unconvinced by arguments along the lines that just because one of the standard types *can* be seen as a container type it must be seen that way, by everyone, no exceptions. That was never the intent of these types, as evidenced by their names and as evidenced by the inherent asymmetry of their instances. Pretending otherwise just creates confusion, of which there are plenty of instances, with more coming as per Andreas' initial mail. Further this generality buys very little if anything in practice as anyone who really needs the functionality can define their own instances or, better, introduce a custom type with a well-chosen name that clearly reflects the application in question. So, indeed, "all consistent but consistently useless", as Henning eloquently put it. To be concrete: after all, why would I write, for an x of type Either Int, say, foldl (+) 0 x and not simply either (const 0) id x ? I know what I find more readable, at least, and I'd be willing to bet on what is more maintainable as well as time passes and code is passed from one group of maintainers to another. Yes, I did see: Kris Nuttycombe wrote:
As with all of these discussions, the point of having Either be Foldable is not that you're going to call foldMap on an Either value directly.
But I must say that strikes me as supremely odd: why on Earth should one *not* make direct use of instance methods if they make so much sense as is claimed? Well, I don't really expect any changes. This is just to say that there still are lots of people who find the push to instantiate Foldable and Traversable as widely as possible very unfortunate. Best, /Henrik This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.