Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
69 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

amindfv


> El 1 abr 2017, a las 05:32, Ivan Lazar Miljenovic <[hidden email]> escribió:
>
> On 1 April 2017 at 19:42, Henrik Nilsson
> <[hidden email]> wrote:
>> Hi all,
>>
>>> It is perfectly to limit the concept of "length" to
>>>
>>> * linear structures (lists, arrays, etc.)
>>>  [branching structures do not have a length, they may have a size or
>>>  maximum depth]
>>>
>>> * which have variable length
>>>  [why would you otherwise ask for the length?]
>>
>> Just for the record, I could not agree more.
>>
>> Looking up "length", e.g. Merriam-Webster:
>>
>>    1a :  the longer or longest dimension of an object
>>
>> What we really are talking about here is counting the number of
>> elements in a data structure. That is clearly applicable to lists
>> as well as trees and tuples interpreted in particular ways.
>>
>> But calling it "length" is not particularly helpful. Nor the effort to
>> reappropriate the very concept of "length" through a categorical
>> interpretation.
>>
>> It would have been a lot better if a name suggesting a sense of
>> counting, or at least a name suggesting that this is something different
>> than the usual length, would have been picked. Maybe elementcount
>> or ever flength.
>
> I agree, but on the other hand this should have been done _before_
> FTP; at this stage, I lean towards marking this down as one of the
> known warts of Haskell - possibly with a 3 major version GHC cycle to
> migrate to a better name once the bikeshedding has been completed -
> and moving on rather than being revisionist and using this as an
> excuse to go backwards.
>
> So far, the arguments against these instances that I've seen are:
>
> * The name of the length function is misleading for such instances
> (with all respect to Tony, agreed; but see above); I don't think I've
> seen anyone else complain about any of the other function names
> though.
>
> * Since these classes/instances are now exported from the Prelude,
> previous code that wouldn't have have type-checked are now valid and
> thus produce unexpected results (I was against the Prelude export when
> FTP was being debated, but now - with the possible exception of people
> learning to program - I think this is a matter of needing to be more
> aware of the types and using our wonderful REPL environments to test
> functions rather than blindly just writing code without validating the
> code logic).

My concern is not that people should be able to write trivial-to-check code without actually testing it. My concern (because it has happened to me in real code!) is people may write complex functions with difficult-to-inspect results.

The bug that was trickiest to track down was a numerical calculation involving a list whose length was almost always 1, that I performed 'length' on. I wrapped the list in a tuple elsewhere in the code, ghc happily typechecked it, and only in rare cases did I get very weird results. This was deep within a larger calculation, and someone could have easily shipped something like this to production.

Tom


>
> TL;DR: I didn't 100% agree with the way FTP was done precisely due to
> the problems people have with these instances, but now let's not go
> backwards (and the tuple instances I've found very useful).
>
>>
>> Names matter.
>>
>> /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.
>>
>>
>> _______________________________________________
>> Libraries mailing list
>> [hidden email]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
>
> --
> Ivan Lazar Miljenovic
> [hidden email]
> http://IvanMiljenovic.wordpress.com
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

amindfv


> El 1 abr 2017, a las 13:45, [hidden email] escribió:
>
>
>
>> El 1 abr 2017, a las 05:32, Ivan Lazar Miljenovic <[hidden email]> escribió:
>>
>> On 1 April 2017 at 19:42, Henrik Nilsson
>> <[hidden email]> wrote:
>>> Hi all,
>>>
>>>> It is perfectly to limit the concept of "length" to
>>>>
>>>> * linear structures (lists, arrays, etc.)
>>>> [branching structures do not have a length, they may have a size or
>>>> maximum depth]
>>>>
>>>> * which have variable length
>>>> [why would you otherwise ask for the length?]
>>>
>>> Just for the record, I could not agree more.
>>>
>>> Looking up "length", e.g. Merriam-Webster:
>>>
>>>   1a :  the longer or longest dimension of an object
>>>
>>> What we really are talking about here is counting the number of
>>> elements in a data structure. That is clearly applicable to lists
>>> as well as trees and tuples interpreted in particular ways.
>>>
>>> But calling it "length" is not particularly helpful. Nor the effort to
>>> reappropriate the very concept of "length" through a categorical
>>> interpretation.
>>>
>>> It would have been a lot better if a name suggesting a sense of
>>> counting, or at least a name suggesting that this is something different
>>> than the usual length, would have been picked. Maybe elementcount
>>> or ever flength.
>>
>> I agree, but on the other hand this should have been done _before_
>> FTP; at this stage, I lean towards marking this down as one of the
>> known warts of Haskell - possibly with a 3 major version GHC cycle to
>> migrate to a better name once the bikeshedding has been completed -
>> and moving on rather than being revisionist and using this as an
>> excuse to go backwards.
>>
>> So far, the arguments against these instances that I've seen are:
>>
>> * The name of the length function is misleading for such instances
>> (with all respect to Tony, agreed; but see above); I don't think I've
>> seen anyone else complain about any of the other function names
>> though.
>>
>> * Since these classes/instances are now exported from the Prelude,
>> previous code that wouldn't have have type-checked are now valid and
>> thus produce unexpected results (I was against the Prelude export when
>> FTP was being debated, but now - with the possible exception of people
>> learning to program - I think this is a matter of needing to be more
>> aware of the types and using our wonderful REPL environments to test
>> functions rather than blindly just writing code without validating the
>> code logic).
>
> My concern is not that people should be able to write trivial-to-check code without actually testing it. My concern (because it has happened to me in real code!) is people may write complex functions with difficult-to-inspect results.
>
> The bug that was trickiest to track down was a numerical calculation involving a list whose length was almost always 1, that I performed 'length' on. I wrapped the list in a tuple elsewhere in the code, ghc happily typechecked it, and only in rare cases did I get very weird results. This was deep within a larger calculation, and someone could have easily shipped something like this to production.
>
> Tom
>

Just to add: I don't think I've experienced bugs like these myself, but

maximum (89,88) == 88

and friends seem prime for returning seemingly-correct results while a bug lurks, uncaught by the typechecker.

Tom



>
>>
>> TL;DR: I didn't 100% agree with the way FTP was done precisely due to
>> the problems people have with these instances, but now let's not go
>> backwards (and the tuple instances I've found very useful).
>>
>>>
>>> Names matter.
>>>
>>> /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.
>>>
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> [hidden email]
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>>
>>
>> --
>> Ivan Lazar Miljenovic
>> [hidden email]
>> http://IvanMiljenovic.wordpress.com
>> _______________________________________________
>> Libraries mailing list
>> [hidden email]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
In reply to this post by Jakub Daniel
Whily you are correct Jakub, I think it's worse than that. Not only is
it like being surpised then length [[1..]] == 1, we also have a kind
system, so we can ignore the name.

length :: f a -> Int

We immediately know that values of the kind (* -> *) slot in to the
value (f), with a kind checker to ensure we get it correct. Therefore,
we can easily reason about the length of values of kind ((,) a)

I do find it hilarious that this discussion continued using the term
"tuple" as if to make a reasonable point. KIND ERROR.


On 01/04/17 22:00, Jakub Daniel wrote:

>> Q: What is the length of pi?
>> A: Dunno, infinity?
>> Q: And what is the length of just pi?
>>
>> GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
>> Prelude> length (Just pi)
>> 1
>>
>> ROFL.
> That is like being surprised about
>
> length [1..]
>
> and
>
> length [[1..]]
>
> though. And I imagine nobody would argue that doesn't make sense. I kind of see why people want better name than length but I see no really good argument why the instance is bad. There are no doubt other generalised notions. It also was an unfair question to ask what mathematicians would think the length of (1,1) was. Because the question is not asked in context where we ask about length for the type (a,-) not (-,-).
>
> Jakub
>
>
>>> On 01.04.2017 12:32, Ivan Lazar Miljenovic wrote:
>>> On 1 April 2017 at 19:42, Henrik Nilsson
>>> <[hidden email]> wrote:
>>>> Hi all,
>>>>
>>>>> It is perfectly to limit the concept of "length" to
>>>>>
>>>>> * linear structures (lists, arrays, etc.)
>>>>>  [branching structures do not have a length, they may have a size or
>>>>>  maximum depth]
>>>>>
>>>>> * which have variable length
>>>>>  [why would you otherwise ask for the length?]
>>>> Just for the record, I could not agree more.
>>>>
>>>> Looking up "length", e.g. Merriam-Webster:
>>>>
>>>>    1a :  the longer or longest dimension of an object
>>>>
>>>> What we really are talking about here is counting the number of
>>>> elements in a data structure. That is clearly applicable to lists
>>>> as well as trees and tuples interpreted in particular ways.
>>>>
>>>> But calling it "length" is not particularly helpful. Nor the effort to
>>>> reappropriate the very concept of "length" through a categorical
>>>> interpretation.
>>>>
>>>> It would have been a lot better if a name suggesting a sense of
>>>> counting, or at least a name suggesting that this is something different
>>>> than the usual length, would have been picked. Maybe elementcount
>>>> or ever flength.
>>> I agree, but on the other hand this should have been done _before_
>>> FTP; at this stage, I lean towards marking this down as one of the
>>> known warts of Haskell - possibly with a 3 major version GHC cycle to
>>> migrate to a better name once the bikeshedding has been completed -
>>> and moving on rather than being revisionist and using this as an
>>> excuse to go backwards.
>>>
>>> So far, the arguments against these instances that I've seen are:
>>>
>>> * The name of the length function is misleading for such instances
>>> (with all respect to Tony, agreed; but see above); I don't think I've
>>> seen anyone else complain about any of the other function names
>>> though.
>>>
>>> * Since these classes/instances are now exported from the Prelude,
>>> previous code that wouldn't have have type-checked are now valid and
>>> thus produce unexpected results (I was against the Prelude export when
>>> FTP was being debated, but now - with the possible exception of people
>>> learning to program - I think this is a matter of needing to be more
>>> aware of the types and using our wonderful REPL environments to test
>>> functions rather than blindly just writing code without validating the
>>> code logic).
>>>
>>> TL;DR: I didn't 100% agree with the way FTP was done precisely due to
>>> the problems people have with these instances, but now let's not go
>>> backwards (and the tuple instances I've found very useful).
>>>
>>>> Names matter.
>>>>
>>>> /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.
>>>>
>>>>
>>>> _______________________________________________
>>>> Libraries mailing list
>>>> [hidden email]
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>>
>>>
>> --
>> Andreas Abel  <><      Du bist der geliebte Mensch.
>>
>> Department of Computer Science and Engineering
>> Chalmers and Gothenburg University, Sweden
>>
>> [hidden email]
>> http://www.cse.chalmers.se/~abela/
>> _______________________________________________
>> Libraries mailing list
>> [hidden email]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Henrik Nilsson-2
On 04/02/2017 01:56 AM, Tony Morris wrote:
> length :: f a -> Int
>
> We immediately know that values of the kind (* -> *) slot in to the
> value (f), with a kind checker to ensure we get it correct. Therefore,
> we can easily reason about the length of values of kind ((,) a)
>
> I do find it hilarious that this discussion continued using the term
> "tuple" as if to make a reasonable point. KIND ERROR.

And it's doubly hilarious that that the above argument is put forward
without any regard for picking an appropriate name for the concept,
which most certainly is very different from "length" as used in
everyday parlance, physics, mathematics, and any CS text-book on
data-structures and algorithms I've ever seen.

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.

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
Join me in not caring about the names. Again, use the types.

It's triply hilarious that we have a typed programming language, and an
increasingly disproportionate user base who don't know how to use those
types. What is this? Amateur hour? Python exists.


On 02/04/17 18:22, Henrik Nilsson wrote:

> On 04/02/2017 01:56 AM, Tony Morris wrote:
>> length :: f a -> Int
>>
>> We immediately know that values of the kind (* -> *) slot in to the
>> value (f), with a kind checker to ensure we get it correct. Therefore,
>> we can easily reason about the length of values of kind ((,) a)
>>
>> I do find it hilarious that this discussion continued using the term
>> "tuple" as if to make a reasonable point. KIND ERROR.
>
> And it's doubly hilarious that that the above argument is put forward
> without any regard for picking an appropriate name for the concept,
> which most certainly is very different from "length" as used in
> everyday parlance, physics, mathematics, and any CS text-book on
> data-structures and algorithms I've ever seen.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Henrik Nilsson-2
On 04/02/2017 09:32 AM, Tony Morris wrote:
> Join me in not caring about the names. Again, use the types.
>
> It's triply hilarious that we have a typed programming language, and an
> increasingly disproportionate user base who don't know how to use those
> types. What is this? Amateur hour? Python exists.
>

I'm sorry, but that's a supremely shallow and entirely
polemic argument devoid of any substance whatsoever.

And implying that people like those who initiated this
thread are "amateurs" and know nothing about types is
both offensive and manifestly unfounded. I suggest you
check their credentials if there is any doubt on your
part.

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.

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Theodore Lief Gannon
In reply to this post by Tony Morris-4
Come on guys, let's keep it respectful, especially considering this is the libraries list. Lively debate is good, but it shouldn't turn to noise.

On Apr 2, 2017 1:33 AM, "Tony Morris" <[hidden email]> wrote:
Join me in not caring about the names. Again, use the types.

It's triply hilarious that we have a typed programming language, and an
increasingly disproportionate user base who don't know how to use those
types. What is this? Amateur hour? Python exists.


On 02/04/17 18:22, Henrik Nilsson wrote:
> On 04/02/2017 01:56 AM, Tony Morris wrote:
>> length :: f a -> Int
>>
>> We immediately know that values of the kind (* -> *) slot in to the
>> value (f), with a kind checker to ensure we get it correct. Therefore,
>> we can easily reason about the length of values of kind ((,) a)
>>
>> I do find it hilarious that this discussion continued using the term
>> "tuple" as if to make a reasonable point. KIND ERROR.
>
> And it's doubly hilarious that that the above argument is put forward
> without any regard for picking an appropriate name for the concept,
> which most certainly is very different from "length" as used in
> everyday parlance, physics, mathematics, and any CS text-book on
> data-structures and algorithms I've ever seen.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
In reply to this post by Henrik Nilsson-2
That's fine. You are welcome to believe these things. You are welcome to
take offense. You are welcome to believe using types responsibly is
"shallow and devoid of substance" or whatever thought might best express
this position that I find ridiculous. You are welcome to believe I would
benefit by checking credentials. I clearly disagree that using types
responsibly is shallow, and I also disagree that I would benefit by
"checking credentials." I think it would be yet another waste of time to
add to those that have been so strongly recommended. That's perfectly fine.

Just keep this amateurism out of my code and we can all carry on. Rather
than checking credentials, I instead demand that I work and seek others
who are skilled at using types. I will fight to retain this ability. I
need to hire people for example. I need to know if they are good at
writing code, using types, etc. I think it is fair to fight for this
ability, without getting personal, as you have chosen to do. I will
continue to fight for this ability regardless.

Anyway, programmers often degenerate into this personal ploppety poo.
So, cheerio. *eyeroll*


On 02/04/17 18:47, Henrik Nilsson wrote:

> On 04/02/2017 09:32 AM, Tony Morris wrote:
>> Join me in not caring about the names. Again, use the types.
>>
>> It's triply hilarious that we have a typed programming language, and an
>> increasingly disproportionate user base who don't know how to use those
>> types. What is this? Amateur hour? Python exists.
>>
>
> I'm sorry, but that's a supremely shallow and entirely
> polemic argument devoid of any substance whatsoever.
>
> And implying that people like those who initiated this
> thread are "amateurs" and know nothing about types is
> both offensive and manifestly unfounded. I suggest you
> check their credentials if there is any doubt on your
> part.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
In reply to this post by Theodore Lief Gannon

It was mostly a joke. Sorry it wasn't understood that way.


On 02/04/17 18:54, Theodore Lief Gannon wrote:
Come on guys, let's keep it respectful, especially considering this is the libraries list. Lively debate is good, but it shouldn't turn to noise.

On Apr 2, 2017 1:33 AM, "Tony Morris" <[hidden email]> wrote:
Join me in not caring about the names. Again, use the types.

It's triply hilarious that we have a typed programming language, and an
increasingly disproportionate user base who don't know how to use those
types. What is this? Amateur hour? Python exists.


On 02/04/17 18:22, Henrik Nilsson wrote:
> On 04/02/2017 01:56 AM, Tony Morris wrote:
>> length :: f a -> Int
>>
>> We immediately know that values of the kind (* -> *) slot in to the
>> value (f), with a kind checker to ensure we get it correct. Therefore,
>> we can easily reason about the length of values of kind ((,) a)
>>
>> I do find it hilarious that this discussion continued using the term
>> "tuple" as if to make a reasonable point. KIND ERROR.
>
> And it's doubly hilarious that that the above argument is put forward
> without any regard for picking an appropriate name for the concept,
> which most certainly is very different from "length" as used in
> everyday parlance, physics, mathematics, and any CS text-book on
> data-structures and algorithms I've ever seen.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (,,) a b

Fumiaki Kinoshita
In reply to this post by Fumiaki Kinoshita
The discussion has diverged to flaming due to a few offensive people. I guess I shouldn't have posted a proposal here, I should have submitted a patch instead.

2017-03-23 19:53 GMT+09:00 Fumiaki Kinoshita <[hidden email]>:
It's surprising that they are missing (forgive me, I'm not here to make people grumpy).


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Fumiaki Kinoshita
In reply to this post by Tony Morris-4
Don't think your "joke" made my proposal more convincing or helped anything.

2017-04-02 18:04 GMT+09:00 Tony Morris <[hidden email]>:

It was mostly a joke. Sorry it wasn't understood that way.


On 02/04/17 18:54, Theodore Lief Gannon wrote:
Come on guys, let's keep it respectful, especially considering this is the libraries list. Lively debate is good, but it shouldn't turn to noise.

On Apr 2, 2017 1:33 AM, "Tony Morris" <[hidden email]> wrote:
Join me in not caring about the names. Again, use the types.

It's triply hilarious that we have a typed programming language, and an
increasingly disproportionate user base who don't know how to use those
types. What is this? Amateur hour? Python exists.


On 02/04/17 18:22, Henrik Nilsson wrote:
> On 04/02/2017 01:56 AM, Tony Morris wrote:
>> length :: f a -> Int
>>
>> We immediately know that values of the kind (* -> *) slot in to the
>> value (f), with a kind checker to ensure we get it correct. Therefore,
>> we can easily reason about the length of values of kind ((,) a)
>>
>> I do find it hilarious that this discussion continued using the term
>> "tuple" as if to make a reasonable point. KIND ERROR.
>
> And it's doubly hilarious that that the above argument is put forward
> without any regard for picking an appropriate name for the concept,
> which most certainly is very different from "length" as used in
> everyday parlance, physics, mathematics, and any CS text-book on
> data-structures and algorithms I've ever seen.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4

Shall we have a big discussion about it? Jeepers creepers mate. Sorry for not apologising correctly.


On 03/04/17 11:44, Fumiaki Kinoshita wrote:
Don't think your "joke" made my proposal more convincing or helped anything.

2017-04-02 18:04 GMT+09:00 Tony Morris <[hidden email]>:

It was mostly a joke. Sorry it wasn't understood that way.


On 02/04/17 18:54, Theodore Lief Gannon wrote:
Come on guys, let's keep it respectful, especially considering this is the libraries list. Lively debate is good, but it shouldn't turn to noise.

On Apr 2, 2017 1:33 AM, "Tony Morris" <[hidden email]> wrote:
Join me in not caring about the names. Again, use the types.

It's triply hilarious that we have a typed programming language, and an
increasingly disproportionate user base who don't know how to use those
types. What is this? Amateur hour? Python exists.


On 02/04/17 18:22, Henrik Nilsson wrote:
> On 04/02/2017 01:56 AM, Tony Morris wrote:
>> length :: f a -> Int
>>
>> We immediately know that values of the kind (* -> *) slot in to the
>> value (f), with a kind checker to ensure we get it correct. Therefore,
>> we can easily reason about the length of values of kind ((,) a)
>>
>> I do find it hilarious that this discussion continued using the term
>> "tuple" as if to make a reasonable point. KIND ERROR.
>
> And it's doubly hilarious that that the above argument is put forward
> without any regard for picking an appropriate name for the concept,
> which most certainly is very different from "length" as used in
> everyday parlance, physics, mathematics, and any CS text-book on
> data-structures and algorithms I've ever seen.
>
> 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.
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries




_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Jon Fairbairn
In reply to this post by Tony Morris-4
Tony Morris <[hidden email]> writes:

> A contrary, consistent position would mean there is a belief in all of
> the following:
>
> * the length of any value of the type ((,) a) is not 1
> * 0 is not an integer

You say this, but I’m wondering why.  (-1) is also an integer,
so can you give me an example for the (-1) case?

  — Jón

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Ben Franksen
In reply to this post by Tony Morris-4
Am 01.04.2017 um 03:27 schrieb Tony Morris:
> The length of ((,) a) is exactly one. Anything else is ridiculous. Try
> arguing against that,

Half true: length for this type makes no sense at all since it is not a
sequence. So there should be no length defined for it.

Just choose a different name.

Cheers
Ben

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris
By "length" here I mean, the function whose name is lima echo november golf tango hotel. I truly do not care what it is called. Follow the types, and the types of the types.

On Thu, Apr 6, 2017 at 12:51 AM, Ben Franksen <[hidden email]> wrote:
Am 01.04.2017 um 03:27 schrieb Tony Morris:
> The length of ((,) a) is exactly one. Anything else is ridiculous. Try
> arguing against that,

Half true: length for this type makes no sense at all since it is not a
sequence. So there should be no length defined for it.

Just choose a different name.

Cheers
Ben

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Jon Fairbairn
In reply to this post by Tony Morris-4
Tony Morris <[hidden email]> writes:

> I did read it. I chose not to respond. I do not believe it to be a
> constructive avenue.
>
> I am repeating myself far less than the misunderstanding and
> inconsistency around "tuples." To this end, I believe is worthwhile to
> continue pointing out the inconsistency, and only slightly less so than
> those who hold a contrary inconsistent position, who are inadvertently
> pointing out the inconsistency. 0 is not an integer is a statement of
> equal validity, buit more obviously not so.

You keep using “integer”, but didn’t answer my question. What
makes you think that integer is the appropriate set? What do the
negative numbers represent in this context? If the answer is
“nothing”, you are actually talking about natural numbers, and
both the sets ℕ and ℕ⁺ are perfectly respectable.

> The length of ((,) a) is exactly one. Anything else is
> ridiculous.

So that I can understand this, please give an example of a
programme where this usage is meaningful.

  — Jón

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Andreas Abel-2
In reply to this post by Tony Morris
On 06.04.2017 05:15, Tony Morris wrote:
> By "length" here I mean, the function whose name is lima echo november
> golf tango hotel. I truly do not care what it is called. Follow the
> types, and the types of the types.

In theory you are right.  But in practice, even a programming language
is more than grammar.  The names make the vocabulary.  There is good
names and bad names for a function.  Good names are the ones everyone
uses.  Programmers use several programming languages, and they want the
names of analogue functions to be the same.  They want to come to a new
language and reuse their vocabulary without bad surprises, as much as
possible.

Here is a classic short story of Swiss writer Peter Bichsel about an old
man, who decides to name a table a "carpet", a bed a "painting" etc.

   A Table is a Table
   http://www.barbarafaessler.com/files/BichselAtableisatable.pdf

The outcome is the expected one...

> On Thu, Apr 6, 2017 at 12:51 AM, Ben Franksen <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Am 01.04.2017 um 03:27 schrieb Tony Morris:
>     > The length of ((,) a) is exactly one. Anything else is ridiculous. Try
>     > arguing against that,
>
>     Half true: length for this type makes no sense at all since it is not a
>     sequence. So there should be no length defined for it.
>
>     Just choose a different name.
>
>     Cheers
>     Ben

--
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

[hidden email]
http://www.cse.chalmers.se/~abela/
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
In reply to this post by Jon Fairbairn
I don't think it is the "appropriate" set. It's an example. 0 is in the
set of integers. The value 0 is in many sets. ((,) a) is the set of
things which are Foldable, and consequently, have a length, which
reasoning by the type and kind system, immediately leads to the
conclusion that it is (very obviously) 1. I am deliberately picking on
the argument, "from obviousness", which is the best counter-argument so
far (according to the counter-arguers; hoping not to misrepresent here).
This is not only a weak argument, I hope we can agree, but *the exact
opposite* is true, where we probably disagree.

Our premises:

  Foldable :: (* -> *) -> Constraint
  length :: forall f. * -> *. f a -> Int
  let length = foldl (+) 0 -- or similar
  let f ~ ((,) a)

Anything but length=1 for not only not "obvious", but I argue completely
ridiculous, by the definition of length. I am not fond of the "argument
from obviousness", but if I am forced to use it, I will, and any
counter-argument will still fail.

PS: I didn't see your original question, sorry. I just stopped looking
at the thread for a bit.


On 06/04/17 17:28, Jon Fairbairn wrote:

> Tony Morris <[hidden email]> writes:
>
>> I did read it. I chose not to respond. I do not believe it to be a
>> constructive avenue.
>>
>> I am repeating myself far less than the misunderstanding and
>> inconsistency around "tuples." To this end, I believe is worthwhile to
>> continue pointing out the inconsistency, and only slightly less so than
>> those who hold a contrary inconsistent position, who are inadvertently
>> pointing out the inconsistency. 0 is not an integer is a statement of
>> equal validity, buit more obviously not so.
> You keep using “integer”, but didn’t answer my question. What
> makes you think that integer is the appropriate set? What do the
> negative numbers represent in this context? If the answer is
> “nothing”, you are actually talking about natural numbers, and
> both the sets ℕ and ℕ⁺ are perfectly respectable.
>
>> The length of ((,) a) is exactly one. Anything else is
>> ridiculous.
> So that I can understand this, please give an example of a
> programme where this usage is meaningful.
>
>   — Jón
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris-4
In reply to this post by Andreas Abel-2
I am not arguing either way on this one. Call it whatever you want, I
don't care. I definitely need that function though. Call it pancakes and
let's move on.


On 06/04/17 17:32, Andreas Abel wrote:

> On 06.04.2017 05:15, Tony Morris wrote:
>> By "length" here I mean, the function whose name is lima echo november
>> golf tango hotel. I truly do not care what it is called. Follow the
>> types, and the types of the types.
>
> In theory you are right.  But in practice, even a programming language
> is more than grammar.  The names make the vocabulary.  There is good
> names and bad names for a function.  Good names are the ones everyone
> uses.  Programmers use several programming languages, and they want
> the names of analogue functions to be the same.  They want to come to
> a new language and reuse their vocabulary without bad surprises, as
> much as possible.
>
> Here is a classic short story of Swiss writer Peter Bichsel about an
> old man, who decides to name a table a "carpet", a bed a "painting" etc.
>
>   A Table is a Table
>   http://www.barbarafaessler.com/files/BichselAtableisatable.pdf
>
> The outcome is the expected one...
>
>> On Thu, Apr 6, 2017 at 12:51 AM, Ben Franksen <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Am 01.04.2017 um 03:27 schrieb Tony Morris:
>>     > The length of ((,) a) is exactly one. Anything else is
>> ridiculous. Try
>>     > arguing against that,
>>
>>     Half true: length for this type makes no sense at all since it is
>> not a
>>     sequence. So there should be no length defined for it.
>>
>>     Just choose a different name.
>>
>>     Cheers
>>     Ben
>


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Henrik Nilsson-2
In reply to this post by Tony Morris
On 04/06/2017 04:15 AM, Tony Morris wrote:
> By "length" here I mean, the function whose name is lima echo november
> golf tango hotel. I truly do not care what it is called. Follow the
> types, and the types of the types.

I think the nub of the matter is that the types (and the types of the
types) (in a language like Haskell) actually are not enough. There are
(literally) infinitely many functions with the same type as "length".
One might argue that few of those make "sense", but that is always
going to be a precarious argument unless the setting is made clear.

More generally, if we were to extrapolate and truly refer to things
by their full specification, then that would be very cumbersome indeed.
By analogy, mathematical theorems are full specifications, and they
usually have names.

Names matter, at least to most people (I dare guess), and in particular
when we rely on the names to convey missing information, as is the
case with "length" given its (Haskell) type.

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.

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
1234