Haskell Foldable Wats (Was: Add conspicuously missing Functor instances for tuples)
Christopher Allen
cma at bitemyapp.com
Wed Feb 24 15:04:41 UTC 2016
Were any of these objections put forward in 1993 when Mark P. Jones
published on constructor classes [1] ? Everything about this follows
directly and uniquely from that design.
[1]: http://web.cecs.pdx.edu/~mpj/pubs/fpca93.pdf
On Wed, Feb 24, 2016 at 7:38 AM, Augustsson, Lennart <
Lennart.Augustsson at sc.com> wrote:
> Of course a pair is a container of two things (which can have different
> types).
>
> You can come up with some different definition of what it means to be a
> container, so that a pair is no longer a container of two things, but this
> is just obfuscation.
>
>
>
> *From:* Libraries [mailto:libraries-bounces at haskell.org] *On Behalf Of *Nathan
> Bouscal
> *Sent:* 24 February 2016 13:29
> *To:* Haskell Libraries
> *Subject:* Re: Haskell Foldable Wats (Was: Add conspicuously missing
> Functor instances for tuples)
>
>
>
> On Wed, Feb 24, 2016 at 1:04 PM, Henrik Nilsson <
> Henrik.Nilsson at nottingham.ac.uk> wrote:
>
> Hi,
>
> On 02/24/2016 11:08 AM, Fumiaki Kinoshita wrote:
>
> Thinking tuples of as multi-element containers is not recommended. A
> tuple (a, b) is, a pair of one 'a' and one 'b';
>
>
> Which, to me, at least, very much sounds like a container of two
> elements?
>
>
>
> You can use essentially the same argument to say that [a] sounds like a
> container of any number of elements, therefore there shouldn't be anything
> wrong with [1, 'foo']. It's not uncommon in programming for "what a thing
> naively sounds like" to be quite different from "what a thing actually is". *Tuples
> are not lists*.
>
>
>
> I agree that there's room for confusion, but there is room for confusion
> in *a lot* of parts of Haskell, especially for people who bring a lot of
> preconceived notions with them. We should try to make the transition easier
> for them, but to me that looks a lot more like "really good error messages"
> and less like pointedly ignoring the structure of types that might be
> confusing.
>
>
>
>
>
>
> Seriosuly, if, as a result of tuples being instances of Functor and
> Foldable etc., the end result is confusion to the point that
> many no longer understand a tuple simply as a container of a certain
> number of elements, then that's another case in point against
> this whole design. (In particular the Foldable part: while I personally
> don't find the functor instances particularly compelling or useful,
> they seem less likely to seriously bite.)
>
> as Foldable works on
> values pointed by the rightmost type argument, 1 should be the only
> reasonable result of 'length'.
>
> data TwoThree a b = TwoThree a a b b b
>
> What should 'length (TwoThree "Foo" "Bar" 0 1 2)' be?
>
>
> A static type error, perhaps?
>
> (As indeed it will be unless the appropriate instances are made
> for TwoThree. But I am guessing we should understand TwoThree
> as a tuple here.)
>
> Looking at only
> the expression, 5 might seem to make sense, but is not meaningful
> considering the type.
>
>
> Best,
>
> /Henrik
> --
> Henrik Nilsson
> School of Computer Science
> The University of Nottingham
> nhn at cs.nott.ac.uk
>
>
>
>
> 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.
>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
--
Chris Allen
Currently working on http://haskellbook.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160224/0a5d57c5/attachment.html>
More information about the Libraries
mailing list