Haskell Foldable Wast

Augustsson, Lennart Lennart.Augustsson at sc.com
Mon Feb 22 07:28:18 UTC 2016

Foldable doesn’t have to be a superclass of Traversable.
Removing it only requires a few minor changes to existing code.

From: Libraries [mailto:libraries-bounces at haskell.org] On Behalf Of Marcin Mrotek
Sent: 21 February 2016 09:05
To: Jeremy
Cc: Haskell Libraries
Subject: Re: Haskell Foldable Wast

It may be that some of the Foldable methods for tuples happen to be useful,
but this does not mean that tuples are foldable.

I think that, as far as Foldable is concerned, a tuple is equivalent to Identity, so this instance is indeed useless. However, Foldable is a superclass of Traversable (and it wouldn't make much sense to make these classes unrelated, as one can always define folds with `traverse`), so I've always found it a necessary evil. Either's instance for Foldable is a little more useful, but equivalent to Maybe's, I think?

But there are, in general, at least two separate use cases for these instances:
a) Using Foldable methods directly on tuples or Eithers - I think it's usually pointless, as I wrote above.
b) Passing a tuple/Either/Maybe/whatever to a more complicated function that requires a Foldable constraint. This is potentially much more useful, and at least saves some wrapping/unwrapping.

Best regards,
Marcin Mrotek

This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html

Insofar as this communication contains any market commentary, the market commentary has been prepared by sales and/or trading desk of Standard Chartered Bank or its affiliate. It is not and does not constitute research material, independent research, recommendation or financial advice. Any market commentary is for information purpose only and shall not be relied for any other purpose, and is subject to the relevant disclaimers available at http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx

Insofar as this e-mail contains the term sheet for a proposed transaction, by responding affirmatively to this e-mail, you agree that you have understood the terms and conditions in the attached term sheet and evaluated the merits and risks of the transaction. We may at times also request you to sign on the term sheet to acknowledge in respect of the same.

Please visit http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx for important information with respect to derivative products.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160222/d5eb6cad/attachment.html>

More information about the Libraries mailing list